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

John Fox jfox at mcmaster.ca
Fri Mar 27 02:53:08 CET 2009

Dear Mike,

As a slight simplification, a legal R name can start with a period (.),
upper- or lower-case letter (A-Z, a-z), and can contain periods, underscores
(_), letters, and numerals; depending upon the locale, some other characters
may also be allowed. This information *is* in the R manuals, though it might
not be that easy to locate: See section 10.3.2 of the R Language Definition
manual or 1.8 of the Introduction to R manual.

@ is used to access slots in an S4 object.

I hope this helps,

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> Behalf Of Mike Miller
> Sent: March-26-09 9:04 PM
> To: R-Help List
> Subject: [R] use of "@" character in variable name
> 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
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list