This function calculates the population standard deviation of a numeric vector.
Unlike the default sd()
function in R, which computes the sample standard deviation,
this function adjusts the calculation to use n instead of n-1 in the denominator.
See also
var_desc
for computing the population variance.
Examples
data <- c(10, 20, 30, 40, 50, NA)
sd_desc(data) # Compute standard deviation including NA (returns NA)
#> [1] NA
sd_desc(data, na.rm = TRUE) # Compute standard deviation ignoring NA
#> [1] 14.14214