[Rd] by should use match.fun

Liaw, Andy andy_liaw at merck.com
Sun Jun 12 21:08:56 CEST 2005


I don't get the point.  ?by says:

FUN a function to be applied to data frame subsets of data. 

It doesn't say FUN can be a character, and by(iris, iris$Species, summary)
works as expected.

Andy

> From: Gabor Grothendieck
> 
> I noticed that, unlike similar functions, 'by' does not use 
> match.fun, e.g.
> 
> > by(iris, iris$Species, "summary")
> Error in FUN(X[[1]], ...) : couldn't find function "FUN"
> 
> The 'by' code should have an initial line of:
> 
> FUN <- match.fun(FUN)
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 
>



More information about the R-devel mailing list