Skip to contents

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

Examples

rowApply(list(1,2,3),function (x) sum(unlist(x)))
#> [1] 1 2 3
df<-data.frame(a=c(1,2,3),b=c(1,2,3))
rowApply(df,sum)
#> [1] 2 4 6