[Rd] bug in gsub with perl=TRUE (PR#8164)

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Sep 30 13:51:58 CEST 2005


Richard.Mott at well.ox.ac.uk wrote:

> Full_Name: Richard Mott
> Version: 2.0.1

This version is completely outdated.
Please try with a *recent* version of R when reporting bugs, in this 
case R-2.2.0 beta (or in worst case R-2.1.1, the current release).

The bug reported below has been fixed some months ago ...

Uwe Ligges

> OS: Linux toad 2.6.9 #4 SMP Mon Feb 21 16:20:16 GMT 2005 x86_64 AMD Opteron(tm) Processor 848 AuthenticAMD GNU/Linux
> Submission from: (NULL) (129.67.46.247)
> 
> 
> gsub with perl=TRUE does not work properly. It pads/truncates the resulting
> string to
> the length of the input string: 
> 
> my.formula <- "log10(Biochem.ALP)^2+1 ~ Family + GENDER"
> 
> 
>>gsub("^.+~", "transformed.y ~", my.formula )
> 
> [1] "transformed.y ~ Family + GENDER"
> 
> 
>>gsub("^.+~", "transformed.y ~", my.formula, perl=TRUE )
> 
> [1] "transformed.y ~ Family + GENDER\0\006\0\0\r\377\0\0\0"  # padded
> 
>  my.formula <- "Biochem.ALP ~ Family + GENDER"
> 
>>gsub("^.+~", "transformed.y ~", my.formula, perl=TRUE )
> 
> [1] "transformed.y ~ Family + GEND"  # truncated
> 
>>gsub("^.+~", "transformed.y ~", my.formula )
> 
> [1] "transformed.y ~ Family + GENDER"
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list