[R] Lexical scoping is not what I expect

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jun 30 14:35:43 CEST 2013


On 13-06-29 11:58 PM, Greg Snow wrote:
> If you want to write really confusing code it is possible to do:
>
> `1` <- 2
>
> `1` + 1
>
> and things like that, but it is probably a good idea not to.

This is actually pretty simple, as the White Knight could tell you.  `1` 
is what the name of 2 is called.  The name really is "2".  It's called 
"two", but that's only what it's called.  It really is two.

Duncan Murdoch

>
>
> On Fri, Jun 28, 2013 at 7: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
>>
>>
>> ______________________________**________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>



More information about the R-help mailing list