Re: [R] rapply on a data.frame

From: Michael Hoffman <>
Date: Sun, 24 Feb 2008 21:01:58 +0000

Michael Hoffman wrote:
> Is it possible to get something like rapply for a data.frame?

On second thought, I can do something like this:

happly <- function(x, fun) {

   if (class(x) == "list") {
     lapply(x, happly, fun)
   } else {

 > happly(list(a=list(c=mtcars, d=Titanic), x=mtcars), nrow) $a
[1] 32

[1] 4

[1] 32

Better suggestions welcome. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sun 24 Feb 2008 - 21:06:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 24 Feb 2008 - 21:30:16 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive