【发布时间】:2018-08-22 00:53:29
【问题描述】:
我有以下字符串向量。它包含两个元素。每个元素都由两个折叠的短语组成。
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"
我想在模式之后进行拆分,但不知道该怎么做。
我想我已经接近解决方案,希望能提供任何帮助。
【问题讨论】: