r - Unable to reference an object in a variable within colnames -


i unable reference object contained in variable "symb" within colnames function. example:

symb <- "ibm"  colnames(paste0(symb)) <- c("open","high","low","close","volume","adjusted")  

if understand question correctly, name columns of data frame called ibm, , variable symb character vector contains string "ibm". if so, might try

df <- get(symb) colnames(df) <- c("open","high","low","close","volume","adjusted") assign(symb, df) 

Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

ruby - How do I merge two hashes into a hash of arrays? -