[R] Lexical scoping is not what I expect
peter dalgaard
pdalgd at gmail.com
Mon Jul 1 10:27:35 CEST 2013
On Jun 30, 2013, at 14:35 , Duncan Murdoch wrote:
> 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
>
Don't you mean "1" and "one"? As in
> as.name("1")
`1`
-pd
>>
>>
>> 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.
>>>
>>
>>
>>
>
> ______________________________________________
> R-help at r-project.org 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.
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list