更新时间:2023-11-22 22:41:04
我不知道这是否是正确的处理方法,但
I don't know if this is the right way to approach it, but
library(dplyr)
df %>% rename_at(vars(col.from), function(x) col.to) %>% head(2)
# mpg cyl disp bar drat foo qsec baz am gear carb
# Mazda RX4 21 6 160 110 3.9 2.620 16.46 0 1 4 4
# Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1 4 4
还请注意,我生活在未来:
Also note that I live in the future:
# packageVersion("dplyr")
# # [1] ‘0.7.0’