foo <- data.frame(
num = 1:6,
txt = c("Do you have any idea what", "they were arguing about?",
"Do--Do you speak", "English?", "yeah...", "No, I'm sorry."
),
stringsAsFactors = FALSE)
## num txt
## 1 1 Do you have any idea what
## 2 2 they were arguing about?
## 3 3 Do--Do you speak
## 4 4 English?
## 5 5 yeah...
## 6 6 No, I'm sorry.
x <- paste0(foo$txt, collapse = " ")
trimws(unlist(strsplit(x, "(?<=[?.!|])(?=\\s)", perl=TRUE)))
## [1] "Do you have any idea what they were arguing about?"
## [2] "Do--Do you speak English?"
## [3] "yeah..."
## [4] "No, I'm sorry."
http://stackoverflow.com/a/33719705/1000343