title: Split string column to create new binary columns
body: <p>My data has one column and I am trying to create additional columns with what’s after each “/” in the rows. Here are the first few rows of the data:</p>
  
  <pre><code>&gt; dput(mydata)
  structure(list(ALL = structure(c(1L, 4L, 4L, 3L, 2L), .Label = c("/
  ca/put/sent_1/fe.gr/eq2_on/eq2_off",
  "/ca/put/sent_1/fe.gr/eq2_on/eq2_off/cbr_LBL", "/ca/put/sent_1/fe.g
  r/eq2_on/eq2_off/cni_at.p3x.4",
  "/ca/put/sent_1/fe.gr/eq2_on/eq2_off/hi.on/hi.ov"), class = "factor
  ")), .Names = "ALL", class = "data.frame", row.names = c(NA,
  -5L))
  </code></pre>
  
  <p>The result should look like this (data frame) with a “1” in the new column if the variable appears in the row and “0” if not:</p>
  
  <pre><code>&gt; dput(Result)
  structure(list(ALL = structure(c(1L, 4L, 5L, 3L, 2L), .Label = c("/ca
  /put/sent_1/fe.gr/eq2_on/eq2_off",
  "/ca/put/sent_1/fe.gr/eq2_on/eq2_off/cbr_LBL", "/ca/put/sent_1/fe.gr/
  eq2_on/eq2_off/cni_at.p3x.4",
  "/ca/put/sent_1/fe.gr/eq2_on/eq2_off/hi.on/hi.ov", "/ca/put/sent_1fe.
  gr/eq2_on/eq2_off/hi.on/hi.ov"
  ), class = "factor"), ca = c(1L, 1L, 1L, 1L, 1L), put = c(1L,
  1L, 1L, 1L, 1L), sent_1 = c(1L, 1L, 1L, 1L, 1L), fe.gr = c(1L,
  1L, 1L, 1L, 1L), eq2_on = c(1L, 1L, 1L, 1L, 1L), eq2_off = c(1L,
  1L, 1L, 1L, 1L), hi.on = c(0L, 1L, 1L, 0L, 0L), hi.ov = c(0L,
  1L, 1L, 0L, 0L), cni_at.p3x.4 = c(0L, 0L, 0L, 1L, 0L), cbr_LBL = c(0L
  ,
  0L, 0L, 0L, 1L)), .Names = c("ALL", "ca", "put", "sent_1", "fe.gr",
  "eq2_on", "eq2_off", "hi.on", "hi.ov", "cni_at.p3x.4", "cbr_LBL"
  ), class = "data.frame", row.names = c(NA, -5L))
  </code></pre>
  
  <p>I have tried many functions including strsplit and sapply:</p>
  
  <pre><code>sapply(strsplit(as.character(mydata$ALL), “\\/”), “[[“, 2) #returns "ca"s only
  
  sapply(strsplit(as.character(mydata$ALL), "\\/"), "[[", 3) #returns "put"s only
  </code></pre>
  
  <p>There are millions of rows and I’d greatly appreciate anything that is quick and efficient.</p>