I have a vector of text values, something like:
Col1
camel; cow; giraffe; panda; zebra
camel; giraffe; zebra
panda; zebra
And I would like to separate these values into an equal number of columns so that the values align vertically in the same columns, with NA where there are gaps so that I get:
Col1, Col2, Col3, Col4, Col5
camel, cow, giraffe, panda, zebra
camel, NA, giraffe, NA, zebra
NA, NA, NA, panda, zebra
How can I accomplish this? I've tried using the 'separate' function in dplyr but this returns error messages, whilst using the 'split' function in splitshapestack allows me to separate the columns but they don't return values that are aligned vertically. I have also tried using the 'lapply' and 'match' in a similar way to this post but again, I keep getting error messages.