[R] Using a string as a variable name

jim holtman jholtman at gmail.com
Sat Oct 21 01:30:29 CEST 2006


frame[[foo]]

On 10/20/06, Jason Horn <jason at 109valentine.com> wrote:
> Is it possible to use a string as a variable name?  For example:
>
> foo<="var1"
> frame$foo   # frame is a data frame with with a column titled "var1"
>
> This does not work, unfortunately.  Am I just missing the correct
> syntax to make this work?
>
>
> - Jason
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list