I'd like to assign a value to a variable the name of which is determined on the fly, and then assign that variable to a column of a data frame, something like:
x = rnorm(10)
y = 'z'
data.frame(assign(y, x))
While assign(y, x) creates z with the right values, it fails to name the data frame's column "z".
Based on the OP comment, the solution would be:
For the other issue you can try:
Output: