I created some dataframes on the fly to hold some data on gas prices:
for(i in 1995:2007) {
assign(paste("gas_data_", i, sep=""),
read.csv(paste("NaturalGasCash", i, ".txt", sep="")))
}
Now I need to create new variables to hold just one column of this dataframes but I don’t know how to do this, I tried:
for(i in 1995:2007){
assign(paste("yields_data_", i, sep=""),
as.value(paste("yields_data_", i, "$X6Mo", sep="")))
}
But now it just creates a variable with a string in it.
Some (untested) example code illustrating my comment above: