[Rd] Syntactically valid names

Davor Cubranic cubranic at stat.ubc.ca
Wed Jul 6 01:55:28 CEST 2011

On June 30, 2011 01:37:57 PM Hadley Wickham wrote:

> Is there any easy way to tell if a string is a syntactically valid name?
> One implementation would be:
> is.syntactic <- function(x) x == make.names(x)
> but I wonder if there's a more elegant way.

This is without quoting, right? Because "make.names" replaces spaces with 
periods, and using quoting I can create syntactically valid names that do 
include spaces:

    `x prime` <- 3


More information about the R-devel mailing list