I\'ve got a simple problem that I haven\'t been able to solve despite the many similar posts, because I\'m a bit of a knucklehead in R, and I\'m not getting whatever it is I sho
for (i in All.Files) {
a <- get(i)
for (j in all.files) {
b <- get(j)
d <- dataframe(mergefun(a, b))
newname <- paste("C", substr(j, 9, 12), sep="")
names(d) <- c("Id", "Country", "logGDP", "GRI", "GRI.group", "Year")
assign(newname,d)
}
}
I fixed your bracketing. It should also be clear that since your newname
only relies on j
that it will be the case that your new variables will only be created on the LAST iteration of the outer for
loop. Thus, you end up with only length(all.files)
variables.