Вот что-то быстрое и грязное, но выполняет свою работу:
library(stringr) # Will use str_extract() with some regex
library(magrittr) # pipes: %>%
library(data.table) # rbindlist (I think dplyr has bind_rows() which is similar)
split(vect, cumsum(grepl("ID", vect))) %>%
lapply(function(x) setNames(data.frame(t(str_extract(x, "\\w+$"))), str_extract(x, "^.+\\s")) ) %>%
rbindlist(fill = TRUE) %>%
setNames(gsub("text|\\\\", "", names(.)))
ID description definition other.info translation
1: a yes yes yes <NA>
2: b <NA> yes yes <NA>
3: d yes <NA> yes yes
Данные :
vect <- c("\\ID a", "\\description text yes", "\\definition text yes", "\\other.info text yes",
"\\ID b", "\\definition text yes", "\\other.info text yes", "\\ID d",
"\\description text yes", "\\other.info text yes", "\\translation text yes"
)