means | R Documentation |
Title means
means( df, ..., group_by_col = NULL, decimales = 2, show_warnings = TRUE, show_errors = FALSE, n = TRUE, missing = TRUE, min = TRUE, max = TRUE, mean = TRUE, sd = TRUE, median = TRUE, range = TRUE, norm.test = TRUE, col_names = c("var", "groups", "n.valid", "n.missing", "min", "max", "mean", "sd", "median", "range", "shapiro-wilk"), lang = "en", DEBUG = FALSE, show.help = FALSE )
df |
data |
... |
any number of numerical variables |
group_by_col |
variable to group the others by |
decimales |
number of decimal to show |
show_warnings |
show warnings |
show_errors |
show errors |
n |
show n (without missing values) |
missing |
show number of missing values |
min |
show min value (or NA) |
max |
show max value (or NA) |
mean |
show mean value |
sd |
show standard deviation |
median |
show median |
range |
show range |
norm.test |
perform Shapiro-Wilks test and show p.value |
col_names |
column names for all columns (must set all or none) |
My own spin on the mean function, working as I like it
data.frame with the corresponding stats
## Not run: data_ <- data.frame(AGE=sample(x = 65:100, size=30, replace = TRUE ), HEIGHT=sample(x = 120:205, size=30, replace = TRUE ), SEX=sample(x = c("Male", "Female"), prob = c(.5,.5), size = 30, replace = TRUE), BLOND=sample(x = c("Yes", "No"), prob = c(.2,.8), size = 30, replace = TRUE) ) data_ <- rbind(data_, list(NA,NA,NA,NA)) data_ <- rbind(data_, list(NA,NA,"Male",NA)) data_ <- rbind(data_, list(NA,NA,NA,"No")) means(data_, AGE) means(data_, AGE,HEIGHT) mean(data_, AGE, group_by_col=SEX) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.