From hadley at rice.edu  Thu Jun 30 22:37:57 2011
From: hadley at rice.edu (Hadley Wickham)
Date: Thu, 30 Jun 2011 15:37:57 -0500
Subject: [Rd] Syntactically valid names
Message-ID: <BANLkTimg=TM0hYA1=Obknb+486Hv8T7Fdw@mail.gmail.com>

Hi all,

Is there any easy way to tell if a string is a syntactically valid name?

e.g.

is.syntactic("X123")
# TRUE
is.syntactic("[[")
# FALSE

One implementation would be:

is.syntactic <- function(x) x == make.names(x)

but I wonder if there's a more elegant way.

Thanks!

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



[Rd] Syntactically valid names
Hadley Wickham