Re: [R] How to turn a string into a variable name ?

From: Erik Iverson <iverson_at_biostat.wisc.edu>
Date: Thu, 13 Mar 2008 23:35:31 -0500

You may be looking for the get function.

See ?get

Ng Stanley wrote:
> Hi,
>
> For example,
>
> natural_nums <- 1:10
> even_nums <- seq(2,10, by = 2)
> types <- c("natural_nums", "even_nums")
>
> What functions can be performed on types[1] to turn it into a variable name
> and not a string ?
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



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 Fri 14 Mar 2008 - 04:42:03 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 Fri 14 Mar 2008 - 05:30:21 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