[R] Strange (non-deterministic) problem with strsplit
Martin Maechler
maechler at stat.math.ethz.ch
Sat Jul 17 10:44:43 CEST 2004
>>>>> "HenrikB" == Henrik Bengtsson <hb at maths.lth.se>
>>>>> on Sat, 17 Jul 2004 01:59:17 +0200 writes:
HenrikB> [Moving this thread to R-devel instead] I suspect
HenrikB> your "random" results are due to a bug in
HenrikB> gsub(). On my R v1.9.0 (Rterm and Rgui) R crashes
HenrikB> when I do
HenrikB> % R --vanilla
>> gsub(" ", "", "abb + c | a*b", perl=TRUE)
HenrikB> Trying
>> gsub(" ", "", "b c + d | a * b", perl=TRUE)
HenrikB> and I'll get NULL. With
>> gsub("\\s", "", "bc + d | a * b", perl=TRUE)
HenrikB> it works as expected. So there is something buggy
HenrikB> for sure.
HenrikB> This might have been fixed in R v1.9.1 or its
HenrikB> patched version.
probably not. Here are results from 1.91-patched
> gsub(" ", "", "b c + d | a * b", perl=TRUE)
NULL
> gsub("\\s", "", "b c + d | a * b", perl=TRUE)
NULL
> gsub("\\s", "", "bc + d | a * b", perl=TRUE)
[1] "bc+d|a*b"
> gsub(" ", "", "bc + d | a * b", perl=TRUE)
[1] "bc+d|a*b"
>
Martin Maechler, ETH Zurich
More information about the R-help
mailing list