Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

umx_apply

umx_apply


Description

Tries to make apply more readable. so "mean of x by columns", instead of "of x, by 2, mean" Other functions to think of include: cumsum(), rowSums(), colMeans(), etc.

Usage

umx_apply(FUN, of, by = c("columns", "rows"), ...)

Arguments

FUN

The function to apply.

of

The dataframe to work with.

by

Apply the function to columns or to rows (default = "columns")

...

optional arguments to FUN, e.g., na.rm = TRUE.

Value

  • object

References

See Also

Examples

umx_apply(mean, mtcars, by = "columns")
umx_apply("mean", of = mtcars, by = "columns")
tmp = mtcars[1:3,]; tmp[1,1] = NA
umx_apply("mean", by = "rows", of = tmp)
umx_apply("mean", by = "rows", of = tmp, na.rm = TRUE)

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.