Here's another possibility:
> x <- c("Apple12","HP42","Dell91")
> strsplit(x,"(?<=\\D)(?=\\d)", perl=TRUE)
[[1]]
[1] "Apple" "12"
[[2]]
[1] "HP" "42"
[[3]]
[1] "Dell" "91"
Krishna Tateneni writes:
> Greetings,
>
> I have a vector of values that are a word followed by a number, e.g.,
ke to know if there's a better way.
Ian Kennedy
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
2 matches
Mail list logo