Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从 R 中的 FOR-LOOP 创建数据帧。
基本上,我想做这样的事情:
for (i in 1:3) { x"i"= 1+i}
在这种情况下,我想获得 3 个数据框:
有没有办法在R中做到这一点?
for (i in 1:3) { assign(paste0("x", i), i + 1) }
这将创建对象x1、x2和x3,其值为i + 1,即 2-4。
x1
x2
x3
i + 1