Stefanie von Felten, IPW&IfU
2006-Mar-12 10:43 UTC
[R] tapply with unequal length of arguments
Hi everyone, Is it possible to use tapply(x,y,mean) if not all groups of x by y are of the same length (for example if you have one missing observation)? I tried tapply(x,y,mean,na.omit=T) but it doesn't work! Steffi -- --------------------------------- Stefanie von Felten Doktorandin ETH Z?rich Institut f?r Pflanzenwissenschaften ETH Zentrum, LFW A 2 Telefon: 044 632 85 97 Telefax: 044 632 11 53 e-mail: stefanie.vonfelten at ipw.agrl.ethz.ch http://www.ipw.agrl.ethz.ch/~svfelten/ und: Universit?t Z?rich Institut f?r Umweltwissenschaften Winterthurerstrasse 190 8057 Z?rich Telefon: 044 635 61 23 Telefax: 044 635 57 11 e-mail: sfelten at uwinst.unizh.ch http://www.unizh.ch/uwinst/homepages/steffi.html
2006/3/12, Stefanie von Felten, IPW&IfU <sfelten at uwinst.unizh.ch>:> Hi everyone, > > Is it possible to use tapply(x,y,mean) if not all groups of x by y are > of the same length (for example if you have one missing observation)?Yes,It works.> I tried tapply(x,y,mean,na.omit=T) but it doesn't work!What does "it doesn't work" mean exactly?Can you give an example and the error msg?> Steffi > -- > --------------------------------- > Stefanie von Felten > Doktorandin > > ETH Z?rich > Institut f?r Pflanzenwissenschaften > ETH Zentrum, LFW A 2 > > Telefon: 044 632 85 97 > Telefax: 044 632 11 53 > e-mail: stefanie.vonfelten at ipw.agrl.ethz.ch > http://www.ipw.agrl.ethz.ch/~svfelten/ > > und: > > Universit?t Z?rich > Institut f?r Umweltwissenschaften > Winterthurerstrasse 190 > 8057 Z?rich > > Telefon: 044 635 61 23 > Telefax: 044 635 57 11 > e-mail: sfelten at uwinst.unizh.ch > http://www.unizh.ch/uwinst/homepages/steffi.html > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- ??? Deparment of Sociology Fudan University
Stefanie von Felten, IPW&IfU wrote:> Hi everyone, > > Is it possible to use tapply(x,y,mean) if not all groups of x by y are > of the same length (for example if you have one missing observation)? > > I tried tapply(x,y,mean,na.omit=T) but it doesn't work!See ?tapply which tells you that the argument "..." is passed to FUN which is mean() in this case. mean() has an argument "na.rm", see ?mean. So we get: tapply(x, y, mean, na.rm = TRUE) Please read the help pages more carefully. Uwe Ligges> Steffi
Possibly Parallel Threads
- type III sums of squares in R
- Manova and specifying the model
- Antw: Re: Confidence interval for the difference between proportions - method used in prop.test()
- discriminant analysis
- Confidence interval for the difference between proportions - method used in prop.test()