Some Summary Statistics
summary.Rd
summary
calculates the five number summary, mean, and standard
deviation of the quantitative variable x
. An optional second, categorical
variable can be specified and values will be calculated separately for
each group. The number of digits in output can also be specified.
Examples
set.seed(0)
fake_data <- rnorm(30) # simulating some data
groups <- sample(c("group1","group2"), 30, TRUE)
summary(fake_data)
#> Missing n Min Q1 Median Q3 Max Mean SD
#> 1 0 30 -1.54 -0.621 -0.031 0.487 2.405 0.022 0.914
summary(fake_data, explanatory = groups, digits = 2) # with groups
#> Missing n Min Q1 Median Q3 Max Mean SD
#> group1 0 13 -1.24 -0.33 -0.06 0.44 1.26 -0.02 0.65
#> group2 0 17 -1.54 -0.89 0.13 0.76 2.40 0.05 1.09