[R] Can't rename a data frame column
jpm miao
miaojpm at gmail.com
Mon May 2 19:27:38 CEST 2016
Hi,
Could someone suggest a way to rename a data frame column? For example,
I want to rename the column beta, but I can't do it this way
> d <- data.frame(alpha=1:3, beta=4:6, gamma=7:9)
> mm<-"beta"
> rename(d, c(mm="two", "gamma"="three"))
The following `from` values were not present in `x`: mm
alpha beta three
1 1 4 7
2 2 5 8
3 3 6 9
********
Of course this would work
> rename(d, c("beta"="two", "gamma"="three"))
alpha two three
1 1 4 7
2 2 5 8
3 3 6 9
[[alternative HTML version deleted]]
More information about the R-help
mailing list