Kenn Konstabel writes:
> Another way (not elegant but better and shorter than the eval-parse
> way) is to use get. ?get
This one is handy for interactive use, thanks for the hint.
Kind Regards,
Michael Bach
__
R-help@r-project.org mailing list
https:
"Nick Sabbe" writes:
> ObjectsOfInterest<- list(one_df, two_df, three_df)
> for(namedf in ObjectsOfInterest){...}
I see. This is also more readable and traceable for others.
> or probably even better
> sapply(ObjectsOfInterest, function(namedf){...})
I like this one for its functional style.
ure Links 653, 9000 Gent
ring: 09/264.59.36
-- Do Not Disapprove
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Michael Bach
Sent: vrijdag 29 april 2011 12:03
To: r-help@r-project.org
Subject: [R] Reference variables by string in
On Fri, Apr 29, 2011 at 1:03 PM, Michael Bach wrote:
> Dear R Users,
>
> I am trying to get the following to work better:
>
> namevec <- c("one", "two", "three")
> for (name in namevec) {
> namedf <- eval(parse(text=paste(name, "_df", sep="")))
> ...
> ...
> }
>
> The rationale behind it
Dear R Users,
I am trying to get the following to work better:
namevec <- c("one", "two", "three")
for (name in namevec) {
namedf <- eval(parse(text=paste(name, "_df", sep="")))
...
...
}
The rationale behind it being that I created variables with names
one_df, two_df and three_df ea
5 matches
Mail list logo