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/

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to