Re: [R] inconsistent output when using variable substitution

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

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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
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 https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive