Error message when running simple 'rename' function in R -
below simple data frame example found in internet. running in rstudio on machine turns out error message:
error: arguments rename must named.
the rename
function seems straight forward doesn't work reasons , can't figure out why.
library("dplyr") d <- data.frame(alpha=1:3, beta=4:6, gamma=7:9) d # alpha beta gamma # 1 1 4 7 # 2 2 5 8 # 3 3 6 9 rename(d, c("beta"="two", "gamma"="three")) #error: arguments rename must named.
mike, command valid "plyr" library. if load "dplyr" in same script error mentioned.
consequently, try instead:
library("plyr") d <- data.frame(alpha=1:3, beta=4:6, gamma=7:9) plyr::rename(d, c("beta"="two", "gamma"="three"))
note sessioninfo()
helps keep track of libraries loaded (attached).
(answer updated after @jaap 's comment)
Comments
Post a Comment