Re: [R] Sub with and without perl=TRUE

2005-02-14 Thread Prof Brian Ripley
This was a bug which is already fixed in R-2.0.1 patched.  From the NEWS 
file

o   gsub(perl=TRUE) returned a string which printed with trailing
garbage if there was a match at the beginning whose
replacement was shorter.  (PR#7479)
The crucial comment is that it only happened for a match at the beginning, 
and sub() was using the same code.

Pre-compiled versions of R-patched for Windows XP are available on CRAN.
On Mon, 14 Feb 2005, Denham Robert wrote:
I have a problem doing substitution using sub and perl=TRUE when the
elements of x have fewer characters than the replacement string.  Let me
show you what I mean:
sub(m,billy,m)
[1] billy
But using perl=TRUE, I can only return a result as long as my x:
sub(m,billy,m,perl=TRUE)
[1] b
sub(m,billy,ma,perl=TRUE)
[1] bi
Etc.
Is this supposed to happen like this? I couldn't see a mention of this
requirement in the help.
I am using R 2.0.1 on windows xp.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Sub with and without perl=TRUE

2005-02-13 Thread Denham Robert
I have a problem doing substitution using sub and perl=TRUE when the
elements of x have fewer characters than the replacement string.  Let me
show you what I mean:

 sub(m,billy,m)
[1] billy

But using perl=TRUE, I can only return a result as long as my x:
 sub(m,billy,m,perl=TRUE)
[1] b

 sub(m,billy,ma,perl=TRUE)
[1] bi

Etc.

Is this supposed to happen like this? I couldn't see a mention of this
requirement in the help.

I am using R 2.0.1 on windows xp.

Robert





The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.
Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  
If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html