From ripley@stats.ox.ac.uk  Wed Aug  7 21:25:50 2002
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Wed, 7 Aug 2002 21:25:50 +0100 (BST)
Subject: read.table ignores first 5 lines (PR#1885)
In-Reply-To: <200208071917.VAA06122@pubhealth.ku.dk>
Message-ID: <Pine.LNX.4.31.0208072124130.24674-100000@gannet.stats>

stdin() from a terminal is not a file, nor is it a standard connection.
So this is not really a bug.

In particular, as used by you it does to have pushback.

On Wed, 7 Aug 2002 Russell-Lenth@uiowa.edu wrote:

> Full_Name: Russ Lenth
> Version: 1.5.0
> OS: Windows
> Submission from: (NULL) (128.255.25.236)
>
>
> If you use read.table with a connection to stdin(), the first
> 5 lines of input seem not to be accepted.  See examples below.
> Did NOT have the same problem with scan().
>
> > version
>         _
> platform i386-pc-mingw32
> arch     i386
> os       mingw32
> system   i386, mingw32
> status
> major    1
> minor    5.0
> year     2002
> month    04
> day      29
> language R
>
> > read.table(stdin(),head=T) -> junk
> 1: a b c
> 1: 1 2 3
> 1: 4 5 6
> 1: 7 8 9
> 1: 10 11 12
> 1: 13 14 15
> 2: 16 17 18
> 3: 19 20 21
> 4: 22 23 24
> 5:
> > junk
>    a  b  c
> 1 13 14 15
> 2 16 17 18
> 3 19 20 21
> 4 22 23 24
>
> > read.table(stdin()) -> junk
> 1: 1 2 3
> 1: 4 5 6
> 1: 7 8 9
> 1: 10 11 12
> 1: 13 14 15
> 1: 16 17 18
> 2: 19 20 21
> 3: 22 23 24
> 4:
> > junk
>   V1 V2 V3
> 1 16 17 18
> 2 19 20 21
> 3 22 23 24
>
> > junk <- scan()
> 1: 4
> 2: 5
> 3: 6
> 4: 7
> 5: 8
> 6: 9
> 7:
> Read 6 items
>
> > junk <- scan(stdin())
> 1: 4
> 2: 5
> 3: 6
> 4: 7
> 5: 8
> 6: 9
> 7:
> Read 6 items
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

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


read.table ignores first 5 lines (PR#1885)
ripley@stats.ox.ac.uk