a296180@mica.fmr.com
2001-Oct-04 11:28 UTC
[Rd] Bug when trying to save a character vector with an embedded / (PR#1115)
Here is an example involving "VIA\B".> version_ platform sparc-sun-solaris2.6 arch sparc os solaris2.6 system sparc, solaris2.6 status major 1 minor 3.0 year 2001 month 06 day 22 language R> ls()character(0)> test <- "VIA\\B" # I proceed the \ with another to escape it. > cat(test, "\n")VIA\B # This is how the string should look.> save(test, ascii = TRUE, file = "here") > remove(list = ls()) > ls()character(0)> load("here") > ls()[1] "test"> cat(test, "\n")VIAB # This is not how the string should look! Where did the \ go?> unlink("here")-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2001-Oct-04 12:43 UTC
[Rd] Bug when trying to save a character vector with an embedded / (PR#1115)
a296180@mica.fmr.com writes:> VIA\B # This is how the string should look. > > save(test, ascii = TRUE, file = "here") > > remove(list = ls()) > > ls() > character(0) > > load("here") > > ls() > [1] "test" > > cat(test, "\n") > VIAB # This is not how the string should look! Where did the \ go?Fixed now for r-devel. Will commit shortly. (Martin, here's a way to test all characters: x <- y <- unlist(as.list( parse(text=paste("\"\\", as.character(structure(0:255,class="octmode")), "\"",sep="")))) save(x, ascii=T, file="here") load("here") all(x==y) - I'd commit it for the regression test suite, but I'm not sure what our conventions are for temporary files) BTW: printing and deparsing x and y causes display corruption. Perhaps we should have an isprint somewhere? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._