[R] referencing values of strings

Liaw, Andy andy_liaw at merck.com
Wed Nov 17 18:23:49 CET 2004


Can you give some hypothetical code on what you want to do?  Does get() do
what you want:

> dog <- "Spot"
> f <- function(x) get(x)
> f("dog")
[1] "Spot"

?

Andy

> From: Apoian, Zack
> 
> Say you have a vector named x and a function which returns 
> the character
> string "x" .  How would I take "x" as an input and return the 
> vector x?
> 
> 
> DISCLAIMER: This e-mail message and any attachments are 
> inte...{{dropped}}
> 
> ______________________________________________
> 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
> 
>




More information about the R-help mailing list