I am having a data.table with a tab separated string that I want to separate into new columns. However, if I slice by index, I just get the first element of the first row for every field. How do I do this?
library(data.table)
a <- c("feature1\titem1\titem2")
dt1 <- data.table(a)
a <- c("feature2\titem3\titem4")
dt2 <- data.table(a)
dt <- rbindlist(list(dt1, dt2))
dt[, split := mapply(str_split, a, "\t", n = 2)]
# how to get a feature column from that?