It's not about data frames: you did not pass tapply a data frame.
There's quite a few strange things here. More likely you intended
> sapply(split(z1$a, z1$b), length)
but that gives list() whereas
> z2 <- subset(z,a == 4)
> sapply(split(z2$a, z2$b), length)
a b c d
0 0 0 1
is as one might ex
Full_Name: Hilmar Berger
Version: 2.4.1/2.6.2alpha
OS: WinXP
Submission from: (NULL) (84.185.128.110)
Hi all,
If I use tapply on an empty data.frame I get an error. I'm not quite sure if one
can actually expect the function to return with a result. However, the error
message suggests that this c
compared to by tapply has the nice property that the output is a
multidimensional array. But in its standard form it only accepts one
vector, a list of factors, and a function of one argument.
Then it splits the vector according to the factor(s) and
applies the function to each of subsets created b