[R] Can you turn a string into a (working) symbol?

R. Michael Weylandt michael.weylandt at gmail.com
Thu Nov 29 11:09:10 CET 2012


On Wed, Nov 28, 2012 at 3:06 AM, andrewH <ahoerner at rprogress.org> wrote:
> Dear Michael –
> This is _very_ interesting and I want to play around with the functions you
> suggest. I had no idea it was so easy to define assignment operators.
>
> However, one question: even after reading the “get” documentation and doing
> a bunch of mousing around for the expressions “pos” and “the search path”, I
> am not sure what function the numeral 1 in these expression serves. Why do I
> want to look in the global environment rather than the current environment?
> I also can not find anything that explains what the default “pos = -1” does.
>
> Thanks for responding!
>
> andrewH

Hi Andrew,

Including context for those of us who don't read via Nabble is always
much appreciated.

I don't have time today to hit this with a hammer till it works, but
IIRC pos = -1 means "current evaluation frame".

See, e.g.,

http://stackoverflow.com/questions/12492226/r-environments-and-function-call-stacks
http://stackoverflow.com/questions/7903414/how-are-environments-enclosures-and-frames-related
http://obeautifulcode.com/R/How-R-Searches-And-Finds-Stuff/

for some hints on getting all that jazz to work right.

MW




More information about the R-help mailing list