On Mon, Feb 20, 2017 at 7:31 AM, Martin Maechler <maech...@stat.math.ethz.ch> wrote: >>>>>> Hervé Pagès <hpa...@fredhutch.org> >>>>>> on Tue, 14 Feb 2017 17:10:05 -0800 writes: > > > Hi, tapply() will work on any object 'X' that has a length > > and supports single-bracket subsetting. These objects are > > sometimes called "vector-like" objects. Atomic vectors, > > lists, S4 objects with a "length" and "[" method, > > etc... are examples of "vector-like" objects. > > > So instead of saying > > > X: an atomic object, typically a vector. > > > I think it would be more accurate if the man page was > > saying something like > > > X: a vector-like object that supports subsetting with > > `[`, typically an atomic vector. > > Thank you, Hervé! > > Actually (someone else mentioned ?) > only length(X) and split(X, <group>) need to work, > and as split() itself is an S3 generic function, X can be even > more general... well depending on how exactly you understand > "vector-like". > > So I would go with > > X: an R object for which a ‘split’ method exists. Typically > vector-like, allowing subsetting with ‘[’.
I think technically tapply() should be using NROW() check that X and INDEX are compatible. That would make it more compatible with split() semantics. Hadley -- http://hadley.nz ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.