Suppose I have the following data table:
DT <- data.table(c("A","B"), c("a;a;b","c"))
which outputs:
V1 V2
1: A a;a;b
2: B c
I am trying (without using for loops) to create an output using data table methods that looks like:
V1 V2
1: A a
2: A a
3: A b
4: B c
I've been able to do something similar by counting the number of elements separated by ";" and then duplicating rows. From there, I loop to change the values but this seems quite slow and I think I'm missing something obvious.
Thanks!