df=data.frame(c(1,2,3),c(4,5,6))
df
c.1..2..3. c.4..5..6.
1 1 4
2 2 5
3 3 6
df.name=c("A","B")
df
c.1..2..3. c.4..5..6.
1 1 4
2 2 5
3 3 6
names(df)
[1] "c.1..2..3." "c.4..5..6."
我想修改df的列名,为什么df.name没有修改成功?
df=data.frame(c(1,2,3),c(4,5,6))
df
c.1..2..3. c.4..5..6.
1 1 4
2 2 5
3 3 6
df.name=c("A","B")
df
c.1..2..3. c.4..5..6.
1 1 4
2 2 5
3 3 6
names(df)
[1] "c.1..2..3." "c.4..5..6."
我想修改df的列名,为什么df.name没有修改成功?
colnames(df) = c("A","B")