Re: [R] Strange output daply with empty strata

2010-09-09 Thread Jan van der Laan
This is a bug, which I've fixed in the development version (hopefully to be released next week). In the plyr 1.2: OK, thank you both for your answers. I'll wait for the next version. Regards, Jan __ R-help@r-project.org mailing list https://stat

Re: [R] Strange output daply with empty strata

2010-09-09 Thread hadley wickham
> daply(data.test, .(municipality, employed), function(d){mean(d$age)} ) >     employed > municipality   no  yes >    A 41.58759 44.67463 >    B 55.57407 43.82545 >    C 43.59330   NA > > The .drop argument has a different meaning in daply. Some R functio

Re: [R] Strange output daply with empty strata

2010-09-09 Thread Dennis Murphy
Hi: Here's what I tried: # data frame versions (aggregate, ddply): aggregate(age ~ municipality + employed, data = data.test, FUN = mean) municipality employed age 1B no 55.57407 2C no 44.67463 3A yes 41.58759 4B yes 43

[R] Strange output daply with empty strata

2010-09-09 Thread Jan van der Laan
Dear list, I get some strange results with daply from the plyr package. In the example below, the average age per municipality for employed en unemployed is calculated. If I do this using tapply (see code below) I get the following result: no yes A NA 36.94931 B 51.2250