I'm looking to create multiple data frames using a for loop and then stitch them together with merge()
.
I'm able to create my data frames using assign(paste(), blah)
. But then, in the same for loop, I need to delete the first column of each of these data frames.
Here's the relevant bits of my code:
for (j in 1:3)
{
#This is to create each data frame
#This works
assign(paste(platform, j, "df", sep = "_"), read.csv(file = paste(masterfilename, extension, sep = "."), header = FALSE, skip = 1, nrows = 100))
#This is to delete first column
#This does not work
assign(paste(platform, j, "df$V1", sep = "_"), NULL)
}
In the first situation I'm assigning my variables to a data frame, so they inherit that type. But in the second situation, I'm assigning it to NULL
.
Does anyone have any suggestions on how I can work this out? Also, is there a more elegant solution than assign()
, which seems to bog down my code? Thanks,
n.i.