[R] Partially reading a file (particularly)
Tobin, Jared
TobinJR at DFO-MPO.GC.CA
Thu May 31 14:37:22 CEST 2007
The responses are much appreciated, thanks.
findstr works and saves a lot of time. I didn't however have much
success with that exact code persay; I get an error message that I don't
understand, as follows:
> c1 <- read.fwf(pipe("findstr /b 5 my.file"), ...)
Error in readLines(con, n, ok, warn, encoding) :
'con' is not a connection
Error in close(file) : no applicable method for "close"
I did however have success with pipe using readLines, albeit in a very
clumsy fashion:
> c1 <- readLines(pipe("findstr /b 5 my.file"))
> write(c1, file="temp.dat")
> t1 <- read.fwf("temp.dat", ...)
Do you receive the same error message as above when using pipe with
read.fwf?
--
jared tobin, student research assistant
dept. of fisheries and oceans
tobinjr at dfo-mpo.gc.ca
-----Original Message-----
From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com]
Sent: Tuesday, May 29, 2007 10:51 PM
To: Charles C. Berry
Cc: Tobin, Jared; r-help at stat.math.ethz.ch
Subject: Re: [R] Partially reading a file (particularly)
On 5/29/07, Charles C. Berry <cberry at tajo.ucsd.edu> wrote:
On windows XP we can also use findstr which comes with Windows:
res <- read.fwf( pipe( "findstr /b 5 my.file" ) , <other args>
)
More information about the R-help
mailing list