scan() + error interferes with count.fields() in some cases (PR#248)

About this list Date view Thread view Subject view Author view Other groups

Subject: scan() + error interferes with count.fields() in some cases (PR#248)
maechler@stat.math.ethz.ch
Date: Sat 14 Aug 1999 - 01:43:48 EST


Message-Id: <199908131543.RAA28991@pubhealth.ku.dk>

As just mentioned on R-devel,
and originally reported (somewhat less concisely) by Adrian Trapletti,

This code

 write(c(paste("\"", LETTERS[1:3],"\"", sep=""),1:3), nc=3)
 scan("data") # gives error as it should
 count.fields("data") # will be wrong
 count.fields("data") # is now ok : 3 3

gives (in 0.64.2 and in 0.65 snapshot)

> write(c(paste("\"", LETTERS[1:3],"\"", sep=""),1:3), nc=3)
> scan("data") # gives error as it should
    Error: "scan" expected a real got ""A""
> count.fields("data") # will be wrong
    [1] 4 3
> count.fields("data") # is now ok : 3 3
    [1] 3 3

>From my experiments, the problem seems to be the leading `` " '' ,
since the following also fails {and btw mixes up ESS ...}

  write(c("\"A", "B", "C",1:3), nc=3)
  scan("data") # gives error as it should
  count.fields("data") # 3 3
  count.fields("data") # >> Error in count.fields..: string terminated by nl..

Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum SOL G1 Sonneggstr.33
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1086 <><

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:07 EST