[R] stringr::str_split_fixed query

David Barron dnbarron at gmail.com
Wed Jan 14 19:47:59 CET 2015


I'm puzzled as to why I get this behaviour with str_split_fixed in the
stringr package.

> stringr::str_split_fixed('ab','',2)
     [,1] [,2]
[1,] ""   "ab"

> stringr::str_split_fixed('ab','',3)
     [,1] [,2] [,3]
[1,] ""   "a"  "b"

In the first example, I was expecting to get
     [,1] [,2]
[1,] "a"   "b"

Can someone explain?

Thanks,
David



More information about the R-help mailing list