0
我想在数据框中的所有列名的末尾添加一些内容,除非列名存在于另一个给定的向量中。更新列名,除非它存在于其他向量中
例如说我有
df <- data.frame('my' = c(1,2,3),
'data' = c(4,5,6),
'is' = c(7,8,9),
'here' = c(10,11,12))
dont_update <- c('my', 'is')
to_add <- '_new'
而且我想
my data_new is here_new
1 1 4 7 10
2 2 5 8 11
3 3 6 9 12