As a relatively inexperienced user of the data.table package in R, I\'ve been trying to process one text column into a large number of indicator columns (dummy variables), w
Here's a somewhat newer approach, using cSplit_e() from the splitstackshape package.
cSplit_e()
splitstackshape
library(splitstackshape) cSplit_e(dt, split.col = "String", sep = "$", type = "character", mode = "binary", fixed = TRUE, fill = 0) # ID String String_a String_b String_c #1 1 a$b 1 1 0 #2 2 b$c 0 1 1 #3 3 c 0 0 1