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]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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