[Rd] bug in gsub with perl=TRUE (PR#8164)
Richard.Mott@well.ox.ac.uk
Richard.Mott at well.ox.ac.uk
Fri Sep 30 11:33:35 CEST 2005
Full_Name: Richard Mott
Version: 2.0.1
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"
More information about the R-devel
mailing list