Description Usage Arguments Methods Internal Class Fields and Methods Author(s) See Also Examples
ConnectionProducer
classes include ScanProducer
,
ReadLinesProducer
, and ReadTableProducer
, providing
Streamer interfaces to scan
, readLines
, and
read.table
.
1 2 3 4 5 6 |
file, con |
The file or connection to be used for input. See
|
... |
Additional arguments, e.g., |
fileArgs, conArgs |
Arguments, e.g., |
scanArgs, readLinesArgs, readTableArgs |
Arguments to
|
See Producer
Methods.
Internal fields of this class are are described with, e.g.,
getRefClass("ReadLinesProducer")$fields
.
Internal methods of this class are described with
getRefClass("ReadLinesProducer")$methods()
and
getRefClass("ReadLinesProducer")$help()
.
Martin Morgan mtmorgan@fhcrc.org
Streamer-package
, Producer-class
,
Streamer-class
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | fl <- system.file(package="Rsamtools", "extdata", "ex1.sam")
p <- ReadLinesProducer(fl, n = 1000) # read 1000 lines at a time
while (length(y <- yield(p)))
print(length(y))
close(p)
p <- ReadTableProducer(fl, quote="", fill=TRUE, nrows=1000)
while (length(y <- yield(p)))
print(dim(y))
reset(p)
dim(yield(p))
## connections opened 'under the hood' are closed, with warnings
rm(p); gc()
## avoid warnings by managing connections
p <- ScanProducer(file(fl, "r"), verbose=TRUE,
scanArgs=list(what=character()))
length(yield(p))
close(p)
rm(p); gc()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.