[R] A bug in the function "scan"?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Dec 25 13:55:51 CET 2000


"Dilip N. Thadani" <thadani at tkk.att.ne.jp> writes:

> R version 1.2
> OS.  Windows NT, service pack 6.0
> 
> Here is what I have in a text file called tmp.txt
> 
> ab,5,b'c,cd,5
> 
> i.e. the file has only one line of data (to keep things simple)
> 
> I issue the command
>  scan(file="c:/tmp.txt",what="",sep=",")
> Read 3 items
> [1] "ab"      "5"       "bc,cd,5"
> 
> >
> 
> Why is it not reading 5 items?  If i remove the apostrophe in the third item
> (ie. b'c => bc) then scan reads all 5 items as I would expect it.
> 
> Is this a bug, or am I missing something about how apostrophe's are treated?

Single and double quotes are used for quoting by default (how else
would you get a separator character into a string?). Look at the
quote= argument to scan. Set quote="" if it bothers you.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list