I have an R data.table
like this:
> old_table
id values
1: 1 A,B,C
2: 2 D,E
3: 3 F
4: 4 G,H,I,J
I want to expand the table by splitting up the values column by commas (,) like so:
> new_table
id value
1: 1 A
2: 1 B
3: 1 C
4: 2 D
5: 2 E
6: 3 F
7: 4 G
7: 4 H
7: 4 I
7: 4 J
Is there an easy way to do this?