I have a dataset in which one of the columns have a string as value.The string has this kind of aspect:F: whatever; F: whatever; P: whatever; P: whatever; C:whatever; C: whatever;
I want to separate that column in 3 columns: one for F, another one for P and another one for C, when there is more than one F (or P or C) I need a different row for each one (remaining the rest of columns the same).
How could I do this?
Thank you in advance!
Example:
Name Value GOsAb1 1000 "F: f1; F: f2; P: p1"Bb1 2000 "P: p1; F: f1"Cb1 3000 "C: c1; F: f1"
what I want as output:
Name Value F P CAb1 1000 f1 p1 -Ab1 1000 f2 p1 -Bb1 2000 f1 p1 -Cb1 3000 f1 - c1
I tried with
str_match(a, "F:\\s*(.*?)\\s*;")
but it only works for the first match, I need all the matches.