Computes standard deviation of a vector with numeric or logical values.

my_sd(x, na.rm = TRUE, inf.rm = TRUE)

Arguments

x

A numeric or logical vector.

na.rm

Boolean specifying whether or not to remove NA and NaN values..

inf.rm

Boolean specifying whether or not to remove Inf values.

Value

The standard deviation of the values in x returned as a numeric vector of length one.

Details

The denominator n - 1 is used which gives an unbiased estimator of the (co)variance for i.i.d. observations.

Examples

x <- 1:10 my_sd(x)
#> [1] 3.02765