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

From: Erik Iverson <iverson_at_biostat.wisc.edu>
Date: Fri 26 Jan 2007 - 16:19:21 GMT

Can I ask why you aren't just passing in the object to your function, but instead a text name for that object?

Ben Fairbank wrote:
> 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.



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 03:35:48 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.