[R] Use a text variable's value to specify another varaible?

From: Ben Fairbank <BEN_at_ssanet.com>
Date: Fri 26 Jan 2007 - 15:48:07 GMT


Greetings guRus --  

If a variable, e.g., 'varname', is a character string, e.g. varname <- "datavector", and I want to apply a function, such as table(), to datavector, what syntax or method will do so using only the variable varname? This seems similar to indirect addressing, but I have not seen a method for it in the R manuals. Is there a general name for such indirect reference that one might search for?  

(This came up while writing a function that takes the value of 'varname' from the keyboard and then applies functions to it.)  

With thanks for any solution,  

Ben Fairbank  

        [[alternative HTML version deleted]]



R-help@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. Received on Sat Jan 27 02:57:12 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 26 Jan 2007 - 17:30:29 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.