[R] gregexpr in R 2.3.0 != gregexpr in R 2.4.0

Stefan Th. Gries stgries_lists at arcor.de
Sat Oct 7 04:00:21 CEST 2006


Hi all

I have a question regarding differences in the way gregpexr works in R 2.3.0 and R 2.4.0.

In R 2.3.0, this is what happens:

> gregexpr(" [a-z] [a-z] ", " a b c d e f ", perl=T)
[[1]]
[1] 1 3 5 7 9
attr(,"match.length")
[1] 5 5 5 5 5


... while in R 2.4.0, this is what happens:

> gregexpr(" [a-z] [a-z] ", " a b c d e f ", perl=T)
[[1]]
[1] 1 7
attr(,"match.length")
[1] 5 5



Looking at the archives, I came across these sites where the reverse issue has been discussed before:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75843.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/76815.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75846.html

>From there, it seems as if the first result has been considered undesirable (apparently because it differs from Perl's output if not also for other reasons) and R. Gentleman wrote that "[t]his has been reverted in R-devel, so you should get the old behavior in it." However,

(i) I could not find any announcement of that change in the change log (the news file at <https://svn.r-project.org/R/trunk/NEWS> or at <http://cran.r-project.org/src/base/NEWS>) so I am still not sure whether this change of behavior is in fact due to changes by the R Development Core Team or not. So, first question: is this change intended or not? (My system has not changed otherwise.)

(ii) Since for some applications of mine the first behavior above was exactly what I needed, I now have the same (second) question as Thomas Girke before: is there a way to get the first of the two results now in R 2.4.0 (on a Windows XP machine)?

Thanks a lot,
STG



More information about the R-help mailing list