On 27/03/2009, at 2:52 PM, Marc Schwartz wrote:


On Mar 26, 2009, at 8:40 PM, Rolf Turner wrote:


On 27/03/2009, at 2:04 PM, 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

I don't know if there is a comprehensive list of the rules governing
variable names but the ``@'' sign is used to access ``slots'' under
S4 classes and methods.  See ?"@".  So it is (like?) an operation/
operator
and hence is ruled out just like ``+5HTT'' would be.  Reserved words
like
``break'' and ``while'' are also excluded.  See fortune(18).

Another rule is that a variable name can't begin with a digit.

And it can't have white space in it.

There are probably other rules, but essentially anything *sensible*
as a variable name can be used as a variable name.


See ?make.names for more information, which is noted in the
description of the 'check.names' argument in the read.table() family
of functions.

It might also be useful to note that a list of reserved words can be found via

        ?Reserved

(as I found out from ??"reserved words").

        cheers,

                Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@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.

Reply via email to