#' Numerical Summaries.
#'
#' Function that returns numerical summaries of the input vector.
#'
#' @param x A vector of numbers.
#' @return Number of non-missing values, mean, median, standard deviation,
#' median average deviation, interquartile range, minimum, maximum.
#' @examples
#' descriptives(1:10)
#' @export
descriptives <- function(x){
# Check for correct values of arguments
funs <- c(mean, median, sd, mad, IQR, min, max)
lapply(funs, function(f) f(x, na.rm = TRUE))
l <- unlist(list(c(nonNA(x),
lapply(funs, function(f) f(x, na.rm = TRUE)))))
names(l) <- c("number of non-NA values", "mean", "median", "sd",
"mad", "IQR", "min", "max")
l
} #this works but I don't have names for statistics
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.