I have the following vector of strings. It contains two elements. Each of the elements is composed by two collapsed phrases.
strings <- c("This is a phrase with a NameThis is another phrase",
"This is a phrase with the number 2019This is another phrase")
I would like to split those phrases for each element in the vector. I've been trying something like:
library(stringr)
str_split(strings, "\\B(?=[a-z|0-9][A-Z])")
which almost gives me what I'm looking for:
[[1]]
[1] "This is a phrase with a Nam" "eThis is another phrase"
[[2]]
[1] "This is a phrase with the number 201" "9This is another phrase"
I would like to make the split AFTER the pattern but cannot figure out how to do that.
I guess I'm close to a solution and would appreciate any help.