list of valid characters in object names

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

list of valid characters in object names

Liviu Andronic
Dear all,
Could someone please point me to the definitive list of valid
characters that are allowed in object names in R? I believe that the
following list covers them:
_.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

but I would like to make sure.

Thank you,
Liviu


--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: list of valid characters in object names

Duncan Murdoch-2
On 13-07-27 7:36 AM, Liviu Andronic wrote:
> Dear all,
> Could someone please point me to the definitive list of valid
> characters that are allowed in object names in R? I believe that the
> following list covers them:
> _.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
>
> but I would like to make sure.

Your question is a little ambiguous.  All characters are allowed in
object names, but the parser will only recognize some of them if they
are quoted in backticks.

The ones it recognizes without the backticks are ones that the C
isalnum() (or iswalnum()) function declares to be alphanumeric, plus .
and _.  Your list above are all allowed, but locales are allowed to
declare other characters to be alpha.  I wouldn't recommend using
anything else, because your code won't be recognized in other locales.

The definitive reference for this is the source code, specifically
src/main/gram.y.  There's some discussion in the Intro to R manual,
section 1.8.

Duncan Murdoch

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: list of valid characters in object names

Liviu Andronic
On Sat, Jul 27, 2013 at 3:08 PM, Duncan Murdoch
<[hidden email]> wrote:

> Your question is a little ambiguous.  All characters are allowed in object
> names, but the parser will only recognize some of them if they are quoted in
> backticks.
>
> The ones it recognizes without the backticks are ones that the C isalnum()
> (or iswalnum()) function declares to be alphanumeric, plus . and _.  Your
> list above are all allowed, but locales are allowed to declare other
> characters to be alpha.  I wouldn't recommend using anything else, because
> your code won't be recognized in other locales.
>
> The definitive reference for this is the source code, specifically
> src/main/gram.y.  There's some discussion in the Intro to R manual, section
> 1.8.
>
Exactly what I was looking for. Thank you,
Liviu

______________________________________________
[hidden email] 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.