rowApply: Applies a function row-wise on any data object.

View source: R/row.r

rowApplyR Documentation

Applies a function row-wise on any data object.

Description

Essentially functions as a MARGIN=1 apply apply but also works on data objects without 2 dimensions such as lists and vectors.

Usage

rowApply(data, fun, ...)

Arguments

data

any R object

fun

the function to evaluate

...

additional arguments to pass to fun

Details

Originally written for the row.r package by Craig Varrichio. Included here because the rowr package was discontinued. I use these functions in my packages

Examples

rowApply(list(1,2,3),function (x) sum(unlist(x)))
df<-data.frame(a=c(1,2,3),b=c(1,2,3))
rowApply(df,sum)

ccpluncw/ccpl_R_chutils documentation built on Feb. 28, 2024, 1:17 a.m.