[R] inconsistent output when using variable substitution
Robert Felty
robfelty at indiana.edu
Fri May 30 23:50:17 CEST 2008
Mark,
Thanks for the reply.
> hi: subset doesn't know what i is but I don't have enough knowledge
> about scope to know what it's actually doing in that case. my
> point is that i wouldn't put i inside a subset command and expect it to
> know the value. scope is very complex in R so
> doing things in the simplest manner is best like the way you do it with
> 49. hopfully someone else will reply with
> a more detaild answer but i have a feeling that that is where your
> problem lies. good luck.
>
I still get the wrong result without i:
Subj[1]
[1] "49"
> thisSubj = subset(Trials,Trials$Subj=="49")
> thisSubj$Ansr[1]
[1] "able"
> thisSubj = subset(Trials,Trials$Subj==Subj[1])
> thisSubj$Ansr[1]
[1] "abacus"
The problem is that I want to use this in a loop, so that I can get a score
for every subject. Maybe there is an alternative way to do this?
Rob
--
Robert Felty
http://robfelty.com
Reality is known to have a liberal bias.
-- Stephen Colbert
More information about the R-help
mailing list