I tried to split string using "-" as delimiter. But why this doesn't work:
> stringr::str_split("158–170", "-")
[[1]]
[1] "158–170"
> strsplit("158–170", "-")
[[1]]
[1] "158–170"
I expect the output to be vector of two strings "158" and "170".
CodePudding user response:
It looks like the dash you have put in your string is longer than the split one (not sure how that's happened). I have replaced them below , please try:
strsplit("158-170", "-")
