I have a data frame in R but want all of the variables in the data frame to be single variables in my working space instead. So, I am looking for a command where I just use command(df)
in the code below and I have Var_A
, Var_B
, Var_C
in my working space.
data <- 1:12
df <- data.frame(matrix(data, ncol = 3))
names(df) <- c("Var_A", "Var_B", "Var_C")
df
> df
Var_A Var_B Var_C
1 1 5 9
2 2 6 10
3 3 7 11
4 4 8 12
EDIT: My question is not an exact duplicate of the suggested question. The suggested question asks why it is not good to do what I want. There is a difference in asking how to do something and why doing something might be bad. Moreover, I don't understand the downvotes. I stated a clear question with a reproucible code sample. Instead of voting me down because one thinks it is a bad thing what I want to do, one could simply answer and propose an alternative.