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

Duncan Murdoch murdoch.duncan at gmail.com
Tue Oct 4 18:18:02 CEST 2011


On 04/10/2011 7:04 AM, S Ellison wrote:
> 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;

Presumably the authors of those packages prefer camelCase.  I don't 
think it's any more complicated than that.

Duncan Murdoch


> 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}}
>
> ______________________________________________
> 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.



More information about the R-help mailing list