[R] Quick question!

Isabel Jones statsonthebrain at yahoo.com
Wed Oct 31 13:37:42 CET 2001

Thanks very much to all who answered my question
yesterday on loops.

Just a further quick question:

If I have this:

for(i in 1:n) {
  subset <- data[which(data$id==i),]

which returns the rows where I have the variable ID=1,
how can I tell the same statement to return just
column Y where ID=i?

I have tried this

for(i in 1:n) {
  subset <- data[which(data$id==i),data$Y]

but it doesn't work

Thanks again


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list