R: rename subset of variables in data frame

后端 未结 5 2155
醉梦人生
醉梦人生 2020-12-21 15:02

I\'m renaming the majority of the variables in a data frame and I\'m not really impressed with my method.

Therefore, does anyone on SO have a smarter or faster way t

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-21 15:37

    names(df)[match(
                    c('old_var1','old_var2'),
                    names(df)
                   )]=c('new_var1', 'new_var2')
    

提交回复
热议问题