[R] problems with by()

Brett Magill bmagill at earthlink.net
Wed Jan 29 22:48:02 CET 2003


> x<-rep(1,10)
> y<-rep(c(1,2),c(5,5))
> z<-seq(1:10)
> ab<-data.frame(x,y,z)
> tapply(ab$z,ab$y,mean)
1 2 
3 8 


-------Original Message-------
From: Heberto Ghezzo <heberto.ghezzo at mcgill.ca>
Sent: 01/29/03 03:24 PM
To: r-help <r-help at stat.math.ethz.ch>
Subject: [R] problems with by()

so, how can I get the function(x) to be applied to each level
of the index variable y.

Actually I use my own function but the same happens, it is applied to all the data and there is no partition of the data acording to index




More information about the R-help mailing list