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.
umx_aggregate(formula = DV ~ condition, data = NA, what = c("mean_sd",
"n"), digits = 2, kable = TRUE)
The aggregation formula. e.g., DV ~ condition
frame to aggregate
function to use. Defaults to a built-in "smart" mean (sd)
for rounding of results
Report as a formatted table? (Default is TRUE)
- table
Other Reporting Functions: loadings.MxModel
,
umxAPA
, umxGetParameters
,
umxSummary
, umx_APA_pval
,
umx_print
, umx_show
,
umx_time
, umx
# NOT RUN {
aggregate(mpg ~ cyl, FUN = mean, na.rm = TRUE, data = mtcars)
umx_aggregate(mpg ~ cyl, data = mtcars)
umx_aggregate(mpg ~ cyl, data = mtcars, kable = FALSE)
umx_aggregate(cbind(mpg, qsec) ~ cyl, data = mtcars, digits = 3)
t(umx_aggregate(cbind(mpg, qsec) ~ cyl, data = mtcars))
# }
# NOT RUN {
umx_aggregate(cbind(moodAvg, mood) ~ condition, data = study1)
# }
Run the code above in your browser using DataLab