[Rd] read.table and strip.white

Uwe Ligges ligges@statistik.uni-dortmund.de
Wed, 31 May 2000 20:34:57 +0200


Prof Brian Ripley wrote:

> > [...]

> I was rather surprised here, and this is not what the prototype does:
> 
>   .col1. .col2. .col3.
> 1      1      1      1
> 2      2      2      2
> 
> Should not strip.white be true for the header line?

If there are no compatibility problems, setting it to TRUE would be
useful ...
But compatibility is an important point, especially in read.table(.), I
think. Many R users have got their own functions using read.table(.), I
suppose. Maybe changing the defaults could break anything?


> That's what the prototype does:
> 
> toucan% cat fff
>   col1, col2, col3
>   a, 1, 1
>   b, 2, 2
> 
> Splus
> > x <- read.table("fff", header=TRUE, sep=",", row.names=NULL)
> > x
>   col1 col2 col3
> 1    a    1    1
> 2    b    2    2
> > as.matrix(x)
>    col1 col2 col3
> 1 "  a" "1"  "1"
> 2 "  b" "2"  "2"
> 
> You can always quote on the header line if you really want names
> with leading spaces.
> 
> I think we could add strip.white for use in the body, quite easily.
>
> Any comments?


Regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._