我无法在colnames函数中引用变量“Symb”中包含的对象。例如:
symb <- "IBM"
colnames(paste0(symb)) <- c("Open","High","Low","Close","Volume","Adjusted")
答案 0 :(得分:2)
如果我理解你的问题,你想要命名一个名为IBM的数据框的列,而变量symb是一个包含字符串“IBM”的字符向量。如果是这样,那么你可以尝试
df <- get(symb)
colnames(df) <- c("Open","High","Low","Close","Volume","Adjusted")
assign(symb, df)