[R] Can you turn an input into a variable name?
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri Oct 4 09:07:53 CEST 2019
Yes. But you should be careful.
"source" is the best way, especially if you put the symbols in a dedicated environment instead of the global environment to avoid your program getting stomped on by your input file.
On October 3, 2019 11:58:51 PM PDT, April Ettington <aprilettington using gmail.com> wrote:
>Let's say I am parsing a file with a list of parameters followed by an
>equal sign, and their corresponding values, eg:
>and I want to use this information to create a variable called color
>the value 'green' and a variable shape with the value 'circle'.
>also want my code to be able to do this *when it doesn't know up front
>the parameter names will be. *So, if the file also included "age=7",
>should still make a variable called age with the value '7', even though
>'age' doesn't specifically appear anywhere in my code. Is there a way
> [[alternative HTML version deleted]]
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
Sent from my phone. Please excuse my brevity.
More information about the R-help