Base R has a function you can use to calculate standard deviation in R.

The standard deviation is a commonly used measure of the degree of variation within a set of data values. A low standard deviation relative to the mean value of a sample means the observations are tightly clustered; larger values indicate observations are more spread out.

### How to Find Standard Deviation in R

You can calculate standard deviation in R using the sd() function.

```
# set up standard deviation in R example
> test <- c(41,34,39,34,34,32,37,32,43,43,24,32)
# standard deviation R function
> sd(test)
[1] 5.501377
```

Need to get the standard deviation for an entire data set? Use the sapply () function to map it across the relevant items. For this example, we’re going to use the ChickWeight dataset in Base R.

```
# standard deviation in R - dataset example
# using head to show the first handful of records
> head(ChickWeight)
weight Time Chick Diet
1 42 0 1 1
2 51 2 1 1
3 59 4 1 1
4 64 6 1 1
5 76 8 1 1
6 93 10 1 1
# standard deviation in R - using sapply to map across columns
> sapply(ChickWeight[,1:4], sd)
weight Time Chick Diet
71.071960 6.758400 13.996847 1.162678
```

Need to work with standard error? We’ve got you covered here….

Related Materials

- Find the mean in R
- Calculate Standard Error in R
- Calculate Standard Deviation in R
- Calculate Variance in R
- Calculate Skewness in R
- Calculate Kurtosis in R
- Calculate Confidence Interval in R
- Using a Chi Square Test in R
- Power analysis in R
- Percentile in R
- Quartile in R