I have a dataframe with the following columns:
tester <- data.frame(id = c(123456789, 987654321))
tester$furniture <- list(c("chair"), c("bed", "bench", "barstool"))
tester$count <- c(1,3)
Based on the value in the count column, each row is repeated [count] number of times:
tester[rep(seq_len(dim(tester_2)[1]), tester$count), ]
The number of items in the furniture list will always be equal to the count value
I want to create a new column that contains one item from the list, in order from the first through the last list item. I would manually input what I want in this new column as:
tester$new <- c("chair", "bench", "bed", "barstool")
but this doesn't work now because the dataframe resulting from the above code only technically has two rows.
Any advice would be greatly appreciated!