I'm trying to split a column by a delimeter, comma in this case, and then make duplicate rows based on the number of elements between commas. I've used str_split_fixed() which will split the column appropriately, but I don't know how to use that to make duplicate rows.
As an example, I have this dataframe:
V1 V2 V3 V4
foo a b 1,2,3
bar c d 1,2
And would like to get it to this dataframe as output:
V1 V2 V3 V4
foo a b 1
foo a b 2
foo a b 3
bar c d 1
bar c d 2