dstats: Simple descriptive statistics for numeric variables
Description
calculates mean, variance or standard deviation and n for numeric variables
Usage
dstats(x,indices=NA,do.sd=FALSE)
Arguments
x
data frame, matrix or vector containing numeric variables
indices
which columns of the data frame or matrix to use
do.sd
logical - return standard deviation rather than variance
Value
A matrix of three rows with the number of columns equal to the number of
variables used.
Meanthe results of applying the mean function
Variance or SDthe results of applying the var function
or the square root of that if do.sd is TRUE
nthe number of observations that are NOT NA
Details
dstats will accept a vector, matrix or data frame. It calculates the
mean, variance and valid n for the columns specified by indices.
If indices is not specified, it will be calculated for the
columns that return TRUE from as.numeric. If do.sd
is TRUE, it returns standard deviations rather than variances. Valid ns are
calculated as the number of observations that are NOT NA.