[R] use of "@" character in variable name

Krzysztof Sakrejda-Leavitt krzysztof.sakrejda at gmail.com
Fri Mar 27 02:31:59 CET 2009


The '@' character is an operator used for accessing slots in S4 classes. 
  Similarly the '$' character is the operator for accessing elements of 
lists, etc...

Although R allows periods, SQL databases will choke on them.  LaTeX will 
(sometimes?) choke on underscores, and of course any native R operator 
will cause problems.  My take is that camelBackCapitalization is the 
best practice in naming columns, list elements, variables, and functions 
for R.

Best,

Krzysztof.

Mike Miller wrote:
> Importing data with a header row using read.delim, one variable should 
> be named @5HTT but it is automatically renamed to X.5HTT, presumably 
> because the "@" is either unacceptable or misunderstood.  I've tried to 
> find out what the rules are on variable names but have been 
> unsuccessful.  I'll bet someone here can tell me where to look.  Maybe 
> it's hidden away in here somewhere:
> 
> http://cran.r-project.org/doc/manuals/R-data.pdf
> 
> Thanks in advance.
> 
> Mike
> 
> ______________________________________________
> 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.
> 

-- 

-----------------------------------------------
Krzysztof Sakrejda-Leavitt

Organismic and Evolutionary Biology
University of Massachusetts, Amherst
319 Morrill Science Center South
611 N. Pleasant Street
Amherst, MA 01003

work #: 413-325-6555
email: sakrejda at nsm.umass.edu




More information about the R-help mailing list