On Thu, 2006-03-16 at 22:28 +0100, [EMAIL PROTECTED] 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 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel