[R] The use of period in function names and variable names

S Ellison S.Ellison at LGCGroup.com
Tue Oct 4 13:04:37 CEST 2011


See para 10.3.2 'Identifiers' in the R language definition (always distributed with R in the html help system), or ?make.names, for a concise statement of what constitutes a valid variable name in R.

It's actually underscores that might give trouble with older versions, not '.'. But they'd have to be a lot older by R standards (pre 1.9.0).

I am not sure why there has been a recent shift away from periods and towards camelCase in some R packages; personally I find a period or underscore much more useful for making a variable name readable. And a mix of camelCase and period.breaks makes it a lot harder to guess which case-sensitive string to use. The number of different combinations of case and period I end up trying for R.Version (occasionally used, never quite often enought to be automatic) defies belief ;-). 


S Ellison

> From: r-help-bounces at r-project.org On Behalf Of Smart Guy
> Sent: 04 October 2011 05:20
> To: r-help at r-project.org
> Subject: [R] The use of period in function names and variable names
> 
> Hi,
>      I am looking for some guidance on whether I can use the 
> period(.) in function names and variable names.

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list