[R] Apply a function for each Row

Liaw, Andy andy_liaw at merck.com
Wed Sep 14 20:20:28 CEST 2005


> From: Barry Rowlingson
> 
> Marc Bernard wrote:
> > Dear All,
> >  
> > I wonder how to apply a given function to  each row of a 
> data frame. I've seen this function before  but don't 
> remember its name....
> 
>   You've just said it twice!
> 
> 'apply'!

A small catch:  Marc wants to apply the function to rows of a data frame,
but apply() expects a matrix or array, and will coerce to such if given a
data frame, which may (or may not) be problematic...

Andy

> Baz
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> 
>




More information about the R-help mailing list