Re: [R] inconsistent output when using variable substitution

From: Robert Felty <>
Date: Fri, 30 May 2008 17:50:17 -0400


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:
[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?


Robert Felty

Reality is known to have a liberal bias.
  -- Stephen Colbert

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 02 Jun 2008 - 06:17:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 02 Jun 2008 - 06:30:42 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive