Skip to content
Prev 279885 / 398506 Next

unexpected behaviour of sub() / usage of regexp

But I do get the incorrect result on R 2.14.0 on linux:
[1] "www"

And also:
[1] "www"
[1] "ww9"
[1] "ww9"

But:
[1] "ewww"
[1] "ewww"

So it seems to be something about the way the curly braces are
handled, but only with certain groups:
[1] "9www"
[1] "ewww"


But, as Prof. Ripley's email suggests, perl=TRUE solves the problem.
(I was trying out various combinations when it appeared in my inbox.)
R version 2.14.0 (2011-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
On Fri, Dec 9, 2011 at 9:25 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: