#' function takes in a single vector, and returns the sample standard deviation of this
#' @param vec vector of numbers
#' @return the standard deviation of that set
#' @examples
#' standardDev(vec)
#' @export
standardDev = function(vec){
mean <- (sum(vec))/(length(vec))
finalValue <- 0
for (i in 1:length(vec)){
finalValue <- finalValue + (vec[i] - mean)**2
}
return( sqrt( finalValue/ (length(vec) - 1) ) )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.