[R] Reading blank lines

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Aug 6 12:24:13 CEST 2000


murdoch at stats.uwo.ca (Duncan Murdoch) writes:

> I'm writing a data.restore function like the one in S-PLUS.  One
> problem:  scan() deletes any blank lines when it reads with
> what=list('').  Is there a way to tell it to convert a blank line to a
> 0 length string element?

I don't know of one. This is Splus 3.x compatible behaviour, it seems,
but it's none too logical to have this happen even with sep="\n"...

$ cat > junkx
line 1
line 2     

line 4
$
...
[Splus]
> scan(file='junkx',what='',sep='\n')
[1] "line 1" "line 2" "line 4"
> read.table(file='junkx')
    V1 V2 
1 line  1
2 line  2
3 line  4

Perhaps we want to add an argument to control this?

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