Learn R Programming

Kmisc (version 0.5.0)

rowApply: Apply Wrappers

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

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.