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 {
fun(x)
}
}
> happly(list(a=list(c=mtcars, d=Titanic), x=mtcars), nrow)
$a
$a$c
[1] 32
$a$d
[1] 4
$x
[1] 32
Better suggestions welcome.
______________________________________________
[email protected] mailing list
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.