I\'ve tried pretty much everything from this similar question, but I can\'t get the results everyone else seems to be getting. This is my problem:
I have a data fram
I've found a workaround. It seems that concat.split.expanded
works if you have a string variable containing nothing but separators and numbers, i.e.:
> profs <- data.frame(teaches = c("1", "1, 2", "2, 3", "1, 2, 3"))
> profs
teaches
1 1
2 1, 2
3 2, 3
4 1, 2, 3
Now concat.split.expanded
works as on Dummy variables from a string variable:
> concat.split.expanded(profs, "teaches", fill = 0, drop = TRUE)
teaches_1 teaches_2 teaches_3
1 1 0 0
2 1 1 0
3 0 1 1
4 1 1 1
However, I'm still looking for a solution which doesn't involve removing all letters from my teaches
variable.