Make Character Strings into Legal S-PLUS Names

DESCRIPTION:
Makes character strings into legal S-PLUS names.

USAGE:
make.names(names, unique=F)

REQUIRED ARGUMENTS:
names:
character vector.

OPTIONAL ARGUMENTS:
unique:
logical flag: should the resulting set of names be unique?

VALUE:
a character vector, each element of which is syntactically a legal name; that is, made up of letters, numbers, and ".", and not beginning with a number.

DETAILS:
The algorithm deletes leading blanks, precedes an empty string or a string starting with a number by "X", and replaces each illegal character by ".". If uniqueness is requested, duplicate values have numbers pasted on as required.

EXAMPLES:
  n1 <- c("abc","ab??","1abc")
  make.names(n1)
[1] "abc"  "ab.." "X1abc"
  make.names(c(n1, "ab..", "ab...1"))
[1] "abc"    "ab.."   "X1abc"  "ab.."   "ab...1"
  make.names(c(n1, "ab..", "ab..1"), T)
[1] "abc"   "ab.."  "X1abc"   "ab..1" "ab..11"
  make.names(rep("",5),T)
[1] "X"  "X1" "X2" "X3" "X4"