Learn R Programming

umx (version 1.4.0)

umx_aggregate: umx_aggregate

Description

R's built-in aggregate function is extremely useful and powerful, allowing xtabs based on a formula. umx_aggregate just tries to make using it a bit easier. In particular, it has some handy base functions that simplify the task of summarising data aggregating over some grouping factor. A common use is preparing summary tables.

Usage

umx_aggregate(formula = DV ~ condition, data, what = c("mean_sd", "n"))

Arguments

formula
The aggregation formula. e.g., DV ~ condition
data
frame to aggregate with
what
function to use. Defaults to a built-in "smart" mean (sd)

Value

- table

References

- https://github.com/tbates/umx, https://tbates.github.io

See Also

- umx_apply, aggregate

Other Reporting Functions: loadings.MxModel, mxSE, umxAPA, umx_APA_pval, umx_print, umx_show, umx_time, umx

Examples

Run this code
aggregate(mpg ~ cyl, FUN = mean, na.rm = TRUE, data = mtcars)
umx_aggregate(mpg ~ cyl, data = mtcars)
umx_aggregate(cbind(mpg, qsec) ~ cyl, data = mtcars)
t(umx_aggregate(cbind(mpg, qsec) ~ cyl, data = mtcars))
## Not run: 
# umx_aggregate(cbind(moodAvg, mood) ~ condition, data = study1)
# ## End(Not run)

Run the code above in your browser using DataLab