I am trying to split a dataframe (df) into its constituent vectors
Example dataframe
v1 <- c(213, 225, 435)
v2 <- c(333, 888, 999)
v2 <- c(788, 666, 545)
df <- data.frame(v1, v2, v3)
Current syntax:
for (i in 1:3) {
assign(paste('v', i, sep = '')) <- df$v[c(i)]
}
Desired output is just:
v1, v2, v3
Is there a way to do this using lapply? Is there a way to do this using a for loop?