[R] Transforming a string to a variable's name? help me newbie...
thjwong at gmail.com
Mon Dec 8 16:45:12 CET 2008
Thanks Jim and All!
tmptrial <- trialcompute(trialextract(
Can I use "assign" instead? How should it be coded then?
On Mon, Dec 8, 2008 at 10:40 AM, Jim Holtman <jholtman at gmail.com> wrote:
> Sent from my iPhone
> On Dec 8, 2008, at 7:11, "tsunhin wong" <thjwong at gmail.com> wrote:
>> Dear all,
>> I'm a newbie in R.
>> I have a 45x2x2x8 design.
>> A dataframe stores the metadata of trials. And each trial has its own
>> data file: I used "read.table" to import every trial into R as a
>> dataframe (variable).
>> Now I dynamically ask R to retrieve trials that fit certain selection
>> criteria, so I use "subset", e.g.
>> tmptrialinfo <- subset(trialinfo, (Subject==24 & Filename=="v2msa8"))
>> The name of the dataframe / variable of an individual trial can be
>> obtained using:
>> Then I get a string:
>> which is of the exact same name of the dataframe / variable of that
>> trial, which is:
>> Can somebody tell me how can I change that string (obtained from
>> "paste()" above) to be a usable / manipulable variable name, so that I
>> can do something, such as:
>> tmptrial <- trialcompute(trialextract(
>> instead of hardcoding:
>> tmptrial <-
>> Currently, 1) doesn't work...
>> Thanks in advance for your help!
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help