作者:日全食x_354 | 来源:互联网 | 2022-12-07 06:50
我有以下字符串向量.它包含两个元素.每个元素由两个折叠短语组成.
strings <- c("This is a phrase with a NameThis is another phrase",
"This is a phrase with the number 2019This is another phrase")
我想将这些短语拆分为向量中的每个元素.我一直在尝试这样的事情:
library(stringr)
str_split(strings, "\\B(?=[a-z|0-9][A-Z])")
几乎给了我正在寻找的东西:
[[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"
我想在模式之后进行拆分,但无法弄清楚如何做到这一点.
我想我接近一个解决方案,并希望得到任何帮助.