开发者

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])
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜