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

Taylor, Z Todd todd.taylor at pnl.gov
Fri Mar 27 19:35:22 CET 2009


Camel case will cause database issues, too, at least if you ever
need to move from one db to another--every one seems to have its
own idea whether to preserve case, up-case, or down-case object
names.  You may not care if you only use one db and only from R.

SomeOfUsFindCamelCaseUnreadableToo.

--Todd
-- 
Why is a Guinea pig neither a pig nor from Guinea?


> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Krzysztof 
> Sakrejda-Leavitt
> Sent: Thursday, March 26, 2009 6:32 PM
> To: Mike Miller
> Cc: R-Help List
> Subject: Re: [R] use of "@" character in variable name
> 
> 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
> 
> ______________________________________________
> 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