[R] no _?

Mark Myatt mark at myatt.demon.co.uk
Mon Dec 10 10:51:56 CET 2001


Jeff D. Hamann <jeff_hamann at hamanndonald.com> writes:
>I see the uderscore "_" is not allowed in R. This make R a real drag when
>trying to use with SQL packages and c code. Why is the underscore not
>allowed and will it be allowed in a future release?

Underscore is allowed but is a 'special' character meaning assign to the
LHS (i.e. it is equivalent to <-). I believe that it is not common or
recommended usage but remains in R for backward compatibility and for
compatibility with S/S+. I assume that you want to sue it a a separator
in variable names (e.g. my_variable. R convention is to use the period
(e.g. my.variable) but this may be a little confusing as the period
tends to be used as a a delimiter between table and variable names
rather like $ in R. You can use the underscore in variable names if you
quote the name (e.g. "my_variable") wherever you use it. This might
prove tediously prone to error. My suggestion is to convert all variable
names to standard R names (i.e. by replacing _ with .) before soing
anything with the data ... see help(make.names) for details on how to do
this simply.

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list