rdesc {walrus} | R Documentation |
Robust Descriptives
Description
Robust Descriptives
Usage
rdesc(
data,
vars,
splitBy = NULL,
mean = TRUE,
trim = TRUE,
tr = 0.2,
win = FALSE,
wl = 0.2,
mest = FALSE,
bend = 1.28,
med = FALSE
)
Arguments
data |
the data as a data frame |
vars |
a vector of strings naming the variables in |
splitBy |
a string naming the variable in |
mean |
|
trim |
|
tr |
a number between 0 and 0.5 (default: 0.2); the proportion of measurements to trim from each end when producing trimmed means |
win |
|
wl |
a number between 0 and 0.5 (default: 0.2); the level of 'winsorizing' when producing winsorized means |
mest |
|
bend |
a number (default: 1.28), the bending constant to use when using M-estimators |
med |
|
Value
A results object containing:
results$table | the table of descriptives | ||||
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$table$asDF
as.data.frame(results$table)
Examples
data('eurosoccer', package='WRS2')
SpainGermany <- subset(eurosoccer, eurosoccer$League == 'Spain' | eurosoccer$League == 'Germany')
SpainGermany <- droplevels(SpainGermany)
walrus::rdesc(
data = SpainGermany,
vars = "GoalsGame",
splitBy = "League",
med = TRUE)
#
# ROBUST DESCRIPTIVES
#
# Robust Descriptives
# ----------------------------------------------------------
# SE
# ----------------------------------------------------------
# GoalsGame Germany Mean 1.46 0.105
# Trimmed mean 1.45 0.1341
# Median 1.43 0.1599
#
# Spain Mean 1.45 0.101
# Trimmed mean 1.33 0.0601
# Median 1.30 0.0766
# ----------------------------------------------------------
#