| descriptives {jmv} | R Documentation |
Provides a range of descriptive statistics
descriptives(data, vars, splitBy = NULL, freq = FALSE, hist = FALSE, dens = FALSE, bar = FALSE, barCounts = FALSE, box = FALSE, violin = FALSE, dot = FALSE, dotType = "jitter", qq = FALSE, n = TRUE, missing = TRUE, mean = TRUE, median = TRUE, mode = FALSE, sum = FALSE, sd = FALSE, variance = FALSE, range = FALSE, min = TRUE, max = TRUE, se = FALSE, skew = FALSE, kurt = FALSE, sw = FALSE, quart = FALSE, pcEqGr = FALSE, pcNEqGr = 4)
data |
the data as a data frame |
vars |
a vector of strings naming the variables of interest in
|
splitBy |
a vector of strings naming the variables used to split
|
freq |
|
hist |
|
dens |
|
bar |
|
barCounts |
|
box |
|
violin |
|
dot |
|
dotType |
. |
qq |
|
n |
|
missing |
|
mean |
|
median |
|
mode |
|
sum |
|
sd |
|
variance |
|
range |
|
min |
|
max |
|
se |
|
skew |
|
kurt |
|
sw |
|
quart |
|
pcEqGr |
|
pcNEqGr |
an integer (default: 4) specifying the number of equal groups |
A results object containing:
results$descriptives | a table of the descriptive statistics | ||||
results$frequencies | an array of frequency tables | ||||
results$plots | an array of descriptive plots | ||||
Tables can be converted to data frames with asDF or as.data.frame. For example:
results$descriptives$asDF
as.data.frame(results$descriptives)
## Not run:
data('mtcars')
dat <- mtcars
# frequency tables can be provided for factors
dat$gear <- as.factor(dat$gear)
descriptives(dat, vars = c('mpg', 'cyl', 'disp', 'gear'), freq = TRUE)
#
# DESCRIPTIVES
#
# Descriptives
# -------------------------------------------
# mpg cyl disp gear
# -------------------------------------------
# N 32 32 32 32
# Missing 0 0 0 0
# Mean 20.1 6.19 231 3.69
# Median 19.2 6.00 196 4.00
# Minimum 10.4 4.00 71.1 3
# Maximum 33.9 8.00 472 5
# -------------------------------------------
#
#
# FREQUENCIES
#
# Frequencies of gear
# --------------------
# Levels Counts
# --------------------
# 3 15
# 4 12
# 5 5
# --------------------
#
## End(Not run)