R dataframe 列名包含减号,列名自动变为点
d<- data.frame(x = c(0, 1))
d<- data.frame(d, y = c(0,1))
names(d)[2]<- "a.-5"
d
x a.-5
0 0
1 1
d1<- data.frame(d, y = c(0,1))
d1
x a..5 y
0 0 0
1 1 1
d2<- data.frame(d, y = c(0,1), check.names=FALSE)
d2
x a.-5 y
0 0 0
1 1 1
REF:
https://stat.ethz.ch/pipermail/r-help/2012-January/301479.html