Apply Wrappers

Share:

Description

These are thin but clearer wrappers to apply(x, 1, FUN, ...) (row apply) and apply(x, 2, FUN, ...) (column apply). Intended for use with 2D R matrixs. We do a bit more work to ensure row names, column names are passed along if appropriate.

Usage

1
2
3
rowApply(X, FUN, ..., drop = TRUE)

colApply(X, FUN, ..., drop = TRUE)

Arguments

X

A matrix, or a 2D array.

FUN

The function to be applied.

...

Optional arguments to FUN.

drop

Boolean. If TRUE, we 'drop' dimensions so that results of dimension n x 1 or 1 x n are coerced to vectors.

Details

See apply for more info.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.