[R] Naming Convention

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 13 18:04:37 CET 2005


On Thu, 13 Jan 2005, Spencer Graves wrote:

>     Also, while any character string is allowed, the use of strings that 
> are not legal names limits their utility, especially for the columns of 
> a data.frame, which could normally be used in a formula for something 
> like "lm" or even more general using "with" or "attach".

That's the advice I was correcting!  Any name can be used in (at least 
simpler versions of) those contexts by use of backquoting.

I think your advice was sound before the introduction of backquoting, but 
is no longer (and that was a while back).

>     hope this helps.  spencer graves

I don't believe it does.


> Prof Brian Ripley wrote:
>
>> On Thu, 13 Jan 2005, [ISO-8859-1] Romain François wrote:
>> 
>>> 
>>> Christoph Scherber a écrit :
>>> 
>>>> Dear Reinhold,
>>>> 
>>>> All entries are allowed except "price swap" or "price_swap"
>>> 
>>> 
>>> As a matter of fact, the syntax price_swap is now allowed (since R 1.9.1 I 
>>> think). The rest is a choice issue ... deprends on you.
>> 
>> 
>> Even "price swap" is allowed, but you will have to work a bit harder, e.g. 
>> call data.frame() with check.names=FALSE and quote the name (preferably 
>> with backticks) when you want to use it.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list