[Rd] A weird behaviour of strsplit?
IAGO GINÉ VÁZQUEZ
|@g|ne @end|ng |rom p@@jd@org
Wed Dec 18 15:42:12 CET 2019
Hi all,
In the help of strsplit one can read
split character vector (or object which can be coerced to such) containing regular expression<http://127.0.0.1:39783/help/library/base/help/regular%20expression>(s) (unless fixed = TRUE) to use for splitting. If empty matches occur, in particular if split has length 0, x is split into single characters. Ifsplit has length greater than 1, it is re-cycled along x.
Taking into account that split is said to be a vector (not a length 1 vector) and the last claim above, I would expect that the output of
strsplit("3:4", split = c(",",":"), fixed = TRUE)
was the same than the output of
strsplit("3:4", split = c(":"), fixed = TRUE)
that is, splitting by "," (without effect in this example) and also by ":"
[[1]]
[1] "3" "4"
But, instead, I get
[[1]]
[1] "3:4"
Am I wrongly understanding the help? Is it an expected output?
I tried with R 3.6.1 for Windows (10).
Thank you!
Iago
[[alternative HTML version deleted]]
More information about the R-devel
mailing list