harald.fekjar@basalmed.uio.no
2001-Mar-08 15:29 UTC
[Rd] Smal problem with porting code to S-PLUS (PR#871)
Full_Name: Harald Fekjær Version: 1.22 OS: Windows Submission from: (NULL) (158.36.132.220) Dear R developers Actually, this is not a bug, but a small remark about a way R is working that makes trouble in porting the code to S. If I run the following i R: --- midl <- 4 attr(midl,"Object created") <- date() dump("midl","midl.R") --- I get a file like: --- "midl" <- structure(4, Object created = "Thu Mar 08 16:04:04 2001") --- This works well inside R, but S-PLUS has trouble reading it, because S needs " around a attribute with spaces. E.g. S-PLUS wants: --- "midl" <- structure(4, "Object created" = "Thu Mar 08 16:04:04 2001") --- This last example reads well into both systems, so way not let R print out the attributes names with "..." Again - Thanks for a wonderful program! Harald Fekjær, Oslo, Norway -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
ripley@stats.ox.ac.uk
2001-Mar-08 16:45 UTC
[Rd] Smal problem with porting code to S-PLUS (PR#871)
> From: harald.fekjar@basalmed.uio.no > Date: Thu, 8 Mar 2001 16:29:55 +0100 (MET) > > Full_Name: Harald Fekjær > Version: 1.22 > OS: Windows > Submission from: (NULL) (158.36.132.220) > > > Dear R developers > > Actually, this is not a bug, but a small remark about a way R is working that > makes trouble in porting the code to S.It *is* a bug: see later.> If I run the following i R: > --- > midl <- 4 > attr(midl,"Object created") <- date() > dump("midl","midl.R") > --- > > I get a file like: > --- > "midl" <- > structure(4, Object created = "Thu Mar 08 16:04:04 2001") > --- > > This works well inside R, but S-PLUS has trouble reading it, because S needs " > around a attribute with spaces. E.g. S-PLUS wants:My version of R can't read that either. Did you try it in R?> source("midl.R")Error in parse(file, n, text, prompt) : syntax error on line 2 Similarly,> deparse(midl)[1] "structure(4, Object created = \"Thu Mar 8 16:24:16 2001\")" cannot be re-parsed.> --- > "midl" <- > structure(4, "Object created" = "Thu Mar 08 16:04:04 2001") > --- > > This last example reads well into both systems, so way not let R print out the > attributes names with "..."Yes, it should do. However, the code (in deparse.c) is pretty complicated and used recursively. I think I have a solution ... still testing. Meanwhile, avoid attributes with non-standard S names. -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
hfe@math.uio.no
2001-Mar-08 17:26 UTC
[Rd] Smal problem with porting code to S-PLUS (PR#871)
On Thu, 8 Mar 2001, Prof Brian Ripley wrote:> ... > > around a attribute with spaces. E.g. S-PLUS wants: > > My version of R can't read that either. Did you try it in R?Dear Prof. Ripley Actually, I did not (Sorry for incorrect reporting first time). I have now tested it, and it is an R bug. Sincerely Harald Fekjaer =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Harald Fekjær | E-mail: harald.fekjar@basalmed.uio.no Researcher | Phone: (+047) 22 85 10 76 University of Oslo, Norway | Homepage: http://www.uio.no/~hfe/ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._