[Rd] by should use match.fun (PR#7936)

From: <ggrothendieck_at_gmail.com>
Date: Tue 14 Jun 2005 - 12:08:06 GMT

Full_Name: G. Grothendieck
Version: R version 2.1.0, 2005-06-10
OS: Windows XP
Submission from: (NULL) (

This is an inconsistency between by and similar functions. The 'by' function should have an initial line of:

FUN <- match.fun(FUN)

All other similar functions including apply, sapply, tapply, lapply work like that so 'by' ought to as well.

Here is an example using the 'iris' data set. Suppose we wish to create a list of rows:

by(iris, row.names(iris), "(")

In every other similar function "(" would have been interpreted as the intended function but here we get an error that it cannot find "(". Although such an error is not inconsistent with the documentation it would seem to violate the consistency of the R base functions mentioned.

There was a discussion of this on r-devel in this thread:


R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Jun 14 22:10:05 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:18 GMT