This is the dataframe I have:
data_frame(id= c(1,2,3),
x=c('19,22,77', '49,67', '28,19,45,23'),
y=c('19,22,77', '49,67', '28,19,45,23'),
t=c('10,20,30', '49,67', '28,19,45,23'))
The comma separated values are different observations over time for the same id
thus I would like to strsplit on comma and reshape in longitudinal format but preserving the association with id
For example, the output for the id=1
only should be:
# A tibble: 3 × 4
id x y t
<dbl> <dbl> <dbl> <dbl>
1 1 19 19 10
2 1 22 22 20
3 1 77 77 30