I have used 'assign' to create a number of variables and assigned to them values:
N <- 10
for(i in 1:N)
{
#create variable names n1, ..., n'N'
assign(paste0("name",i), data.frame(matrix(1:100, ncol=3, nrow=100)))
}
I now need to be able to access these variable names, but NOT assign anything to them; I need to just change their column headers (in this application). The following code doesn't work, but something like this:
for(i in 1:N)
{
#create proper column headers
colnames(assign(paste0("name",i), ???) <- c("a","b","c")
}
I would like to know what to put in place of "???" or to learn of a different approach.
There are other applications that would also not involve assigning anything to the variables.