From maechler at stat.math.ethz.ch  Sat Jul 17 10:44:43 2004
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat Jul 17 10:44:44 2004
Subject: [Rd] RE: [R] Strange (non-deterministic) problem with strsplit
In-Reply-To: <004501c46b90$efe19ea0$0701a8c0@hblaptop>
References: <f8e6ff05040716135022ed686e@mail.gmail.com>
	<004501c46b90$efe19ea0$0701a8c0@hblaptop>
Message-ID: <16632.59131.544548.337755@gargle.gargle.HOWL>

>>>>> "HenrikB" == Henrik Bengtsson <hb@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


[Rd] RE: [R] Strange (non-deterministic) problem with strsplit
Martin Maechler