Message-ID: <Pine.SO4.4.10.10110311345160.16699-100000@ufobi7.uni-forst.gwdg.de>
Date: 2001-10-31T12:47:04Z
From: Jens Nieschulze
Subject: Quick question!
In-Reply-To: <20011031123742.47261.qmail@web20802.mail.yahoo.com>
On Wed, 31 Oct 2001, Isabel Jones wrote:
> 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]
for(i in 1:n) {
subset <- data[which(data$id==i),"Y"]
maybe?
>
> but it doesn't work
>
> Thanks again
> Isabel
>
***********************************************************************
Jens Nieschulze
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._