I have a data frame in which one column is a list of vectors, with various lengths. This code creates an example:
df1 <- data.frame(
A=c("able", "baker", "carr"),
B=c("whiskey", "tango", "foxtrot")
)
df1$C <- list(14, c(2,18,32), c(10,6))
The actual data originated in an SPSS database. (BTW, I could not figure out how to create this example with a single statement.)
I'd like to convert it to a data frame like the one created by the following code:
df2 <- data.frame(
A=c("able", rep("baker",3), rep("carr",2)),
B=c("whiskey", rep("tango",3), rep("foxtrot",2)),
C=c(14, 2, 18, 32, 10, 6)
)
I don't want to resort to ugly surgery and looping -- been there, done that.