Is there a way to split data based on value of character in dataframe into multiple columns, so that for example, I start with this data frame
initialData = data.frame(attr = c('a','b','c','d'), type=c('1,2','2','3','2,3'))
And the endData is something like this:
attr Conditions Cond1 Cond2 Cond3
1 a 1,2 TRUE TRUE FALSE
2 b 2 FALSE TRUE FALSE
3 c 3 FALSE FALSE TRUE
4 d 2,3 FALSE TRUE TRUE
I've written a function that takes in a character, does a regexp on it to see if the condition is met and then returns true or false, but I'm not sure how to go through each line in the data frame and add to the correct column