I'm trying to create a data frame in which some of the column names
contain a dash "-". A simple example:

d <- data.frame(x = c(0, 1))
d <- data.frame(d, y = c(0,1))
names(d)[2] <- "a.-5"
d
  x a.-5
1 0    0
2 1    1

d <- data.frame(d, y = c(0,1))
d
  x a..5 y
1 0    0 0
2 1    1 1

names(d)[2] <- "a.-5"
d
  x a.-5 y
1 0    0 0
2 1    1 1

Why does the "a.-5" column name change to "a..5" when another column is added?

Thanks,
Mark Seeto

______________________________________________
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