【发布时间】:2017-09-16 08:34:58
【问题描述】:
我希望将相同的值分配给data.frame 中的多个变量。我在这里查看了多个看起来相似的帖子,但似乎没有解决我的具体问题。
Mass variable declaration and assignment in R?
Assign multiple new variables on LHS in a single line in R
这是我想创建的data.frame 示例:
data = data.frame(
a1 = 0.614, a2 = 0.614, a3 = 0.614, a4 = 0.614, a5 = 0.614,
a6 = 0.614, a7 = 0.614, a8 = 0.614, a9 = 0.614, a10 = 0.614,
c1 = -6.198, c2 = -6.198, c3 = -6.198, c4 = -6.198, c5 = -6.198,
c6 = -6.198, c7 = -6.198, c8 = -6.198, c9 = -6.198, c10 = -6.198,
d1 = 35.952, d2 = 35.952, d3 = 35.952, d4 = 35.952, d5 = 35.952,
d6 = 35.952, d7 = 35.952, d8 = 35.952, d9 = 35.952, d10 = 35.952)
感谢您的任何建议或帮助。我更喜欢基础R 中的解决方案。很抱歉,如果答案很明显。
【问题讨论】:
标签: r