Generating data.frame objects with a for loop
Is there a way to dynamically create a data.frame (or any object for that matter) witho开发者_如何学编程ut it being initialized as a variable? For example:
for(x in 1:26) {
paste(letters[x]) <- df[x]
}
Such that you have new variables a,b,c,d,...,z?
Searching around, I found it:
for(x in 1:26) {
assign(paste(letters[x]), df[x])
}
精彩评论