From pdalgd at gmail.com  Wed Jul  6 02:22:04 2011
From: pdalgd at gmail.com (peter dalgaard)
Date: Wed, 6 Jul 2011 02:22:04 +0200
Subject: [Rd] Syntactically valid names
In-Reply-To: <CABdHhvEhKGZjSX_fRAAi6_PjHgnhOra_f7w8Y+R8Pw8gGm92OQ@mail.gmail.com>
References: <BANLkTimg=TM0hYA1=Obknb+486Hv8T7Fdw@mail.gmail.com>
	<2698F67A-DDF9-4EAF-B7A8-A4FAAE9CCC6B@gmail.com>
	<CABdHhvHmRP6XOkTq+4Z1NjvW1SRwqt1AUwga_ovbMOfi3zi5oA@mail.gmail.com>
	<CAFFLneRp4YY7U+Nn26C+hFhX-4PWaHZMFizBmgEtNg2jjK93qg@mail.gmail.com>
	<CABdHhvEhKGZjSX_fRAAi6_PjHgnhOra_f7w8Y+R8Pw8gGm92OQ@mail.gmail.com>
Message-ID: <A16B0AB7-C30E-482D-B91A-EC3CC2C70CB9@gmail.com>


On Jul 6, 2011, at 01:40 , Hadley Wickham wrote:

> On Tue, Jul 5, 2011 at 7:31 PM, steven mosher <moshersteven at gmail.com> wrote:
>>  regexp approach is kinda ugly
>> http://www.r-bloggers.com/testing-for-valid-variable-names/
> 
> Hmm, I think that suggests a couple of small bug in make.names:
> 
>> make.names("...")
> [1] "..."
>> make.names("..1")
> [1] "..1"
> 

What's wrong with that? They are names alright, just with special meanings.

> x <- quote(...)
> mode(x)
[1] "name"


> and
> 
>> x <- paste(rep("x", 1e6), collapse = "")
>> x == make.names(x)
> [1] TRUE
> 
> 

Mildly insane, but technically OK, no?


> Hadley
> 
> -- 
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/

-- 
Peter Dalgaard
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



[Rd] Syntactically valid names
peter dalgaard