[R] Lexical scoping is not what I expect

Yihui Xie xie at yihui.name
Sat Jun 29 04:11:36 CEST 2013


I just realized this was also possible:

> assign('TRUE', FALSE)
> TRUE
[1] TRUE
> get('TRUE')
[1] FALSE

but it is probably a different story.

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 206-667-4385 Web: http://yihui.name
Fred Hutchinson Cancer Research Center, Seattle


On Fri, Jun 28, 2013 at 6:30 PM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
> On 29/06/13 02:54, John Fox wrote:
>>
>> Dear Duncan and Steve,
>>
>> Since Steve's example raises it, I've never understood why it's legal to
>> change the built-in global "constants" in R, including T and F. That just
>> seems to me to set a trap for users. Why not treat these as reserved
>> symbols, like TRUE, Inf, etc.?
>
>
> I rather enjoy being able to set
>
>     pi <- 3
>
> :-)
>
>     cheers,
>
>         Rolf Turner



More information about the R-help mailing list