On 12-01-14 5:47 AM, Ajay Askoolum wrote:
Is there a way to tell whether an object name 1. is valid 2. is not going to 
cause a collision with an existing object by the same name?

For 1, you could put your names in a character vector x, then check whether x and make.names(x) are identical; if so, x contains syntactically valid names. (Do remember that almost anything can be a name if you put it in back quotes.)

For 2, you could check exists(x) to find if objects with those names exist.

Duncan Murdoch

______________________________________________
R-help@r-project.org 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 via email to