I wish to assign the same value to multiple variables in a data.frame
. I have looked at multiple posts here that seem similar, but do not appear to address my specific problem.
Mass variable declaration and assignment in R?
Assign multiple new variables on LHS in a single line in R
Here is an example data.frame
I would like to create:
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)
Thank you for any advice or assistance. I prefer a solution in base R
. Sorry if the answer is obvious.