#' Skewness
#'
#' This function returns the skewness of the data. This
#' function is writen to remove NAs and use the bias-
#' corrected statistics. The third moment about the mean
#' is computed and divided by the cube of the standard
#' deviation.
#'
#' @param x data
#' @return skewness
#' @export
skew <- function(x) {
m <- mean(x, na.rm = TRUE)
nas <- which(is.na(x))
n <- length(x) - length(nas)
s <- (sum((x-m)^2, na.rm = TRUE)/(n-1))^0.5
m3 <- (sum((x-m)^3, na.rm = TRUE)/(n-1))
skew <- m3/(s^3)
return(skew)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.