Full_Name: Todd Bailey Version: 2.1 OS: Mac OS-X 10.4.3 Submission from: (NULL) (87.112.79.124) sub returns garbage in some strings when replacing something with nothing and fixed=TRUE. For example:> a=c('hello','hello'); sub('lo','',a,fixed=TRUE)[1] "hel" "hel\0\0"> a=c('hello','hello'); sub('lo','',a,fixed=FALSE)[1] "hel" "hel"> version_ platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status major 2 minor 2.1 year 2005 month 12 day 20 svn rev 36812 language R
todd at baileywick.plus.com writes:> Full_Name: Todd Bailey > Version: 2.1Er, 2.2.1....> OS: Mac OS-X 10.4.3 > Submission from: (NULL) (87.112.79.124) > > > sub returns garbage in some strings when replacing something with nothing and > fixed=TRUE. For example: > > > a=c('hello','hello'); sub('lo','',a,fixed=TRUE) > [1] "hel" "hel\0\0" > > a=c('hello','hello'); sub('lo','',a,fixed=FALSE) > [1] "hel" "hel"Confirmed on Linux & Windows. We've seen this symptom a few times before....> > > version > _ > platform powerpc-apple-darwin7.9.0 > arch powerpc > os darwin7.9.0 > system powerpc, darwin7.9.0 > status > major 2 > minor 2.1 > year 2005 > month 12 > day 20 > svn rev 36812 > language R > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
On Thu, 2006-03-16 at 22:28 +0100, todd at baileywick.plus.com wrote:> Full_Name: Todd Bailey > Version: 2.1 > OS: Mac OS-X 10.4.3 > Submission from: (NULL) (87.112.79.124) > > > sub returns garbage in some strings when replacing something with nothing and > fixed=TRUE. For example: > > > a=c('hello','hello'); sub('lo','',a,fixed=TRUE) > [1] "hel" "hel\0\0" > > a=c('hello','hello'); sub('lo','',a,fixed=FALSE) > [1] "hel" "hel"This has been fixed in R Patched. From NEWS: o sub(fixed = TRUE) could get wrong the length of the character string of elements of the result after the first.>From my installation:> a <- c('hello', 'hello'); sub('lo', '', a, fixed=TRUE)[1] "hel" "hel"> a <- c('hello', 'hello'); sub('lo', '', a, fixed=FALSE)[1] "hel" "hel" HTH, Marc Schwartz
Peter Dalgaard <p.dalgaard at biostat.ku.dk> writes:> todd at baileywick.plus.com writes: > > > Full_Name: Todd Bailey > > Version: 2.1 > > Er, 2.2.1.... > > > OS: Mac OS-X 10.4.3 > > Submission from: (NULL) (87.112.79.124) > > > > > > sub returns garbage in some strings when replacing something with nothing and > > fixed=TRUE. For example: > > > > > a=c('hello','hello'); sub('lo','',a,fixed=TRUE) > > [1] "hel" "hel\0\0" > > > a=c('hello','hello'); sub('lo','',a,fixed=FALSE) > > [1] "hel" "hel" > > Confirmed on Linux & Windows. We've seen this symptom a few times > before.......and fixed it, apparently! (Thanks Marc.) I claim XP braindamage -- I'm not Linuxifying my new ThinkPad until FC5 is out. -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907