Streamer-package(Streamer)
Streamer-package()所属R语言包:Streamer
Enable stream processing of large files
启用流处理大文件
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Large data files can be difficult to work with in R, where data generally resides in memory. This package encourages a style of programming where data is 'streamed' from disk into R through a series of components that, typically, reduce the original data to a manageable size. The package provides useful Producer and Consumer components for operations such as data input, sampling, indexing, and transformation.
大型数据文件是很困难的工作,在研发,数据一般驻留在内存中。鼓励此包数据“流”从磁盘到R,通过一系列的组成部分,通常情况下,减少原始数据管理的大小的编程风格。该软件包提供有用的Producer和Consumer组件,如数据输入,采样,索引和转换操作。
Details
详情----------Details----------
The central paradigm in this package is a stream composed of a Producer and zero or more Consumer components. The Producer is responsible for input of data, e.g., from the file system. A Consumer accepts data from a Producer and performs transformations on it. The stream function is used to assemble a Producer and zero or more Consumer components into a single string.
在此套件中的核心模式是一个streamProducer“零个或多个Consumer组件组成。 Producer是负责输入数据,例如,从文件系统。一个ConsumerProducer接受数据,并执行它的转换。 stream函数Producer“零个或多个Consumer组件组装成一个字符串。
The yield function can be applied to a stream to generate one "chunk" of data. The definition of chunk depends on the stream and its components. A common paradigm repeatedly invokes yield on a stream, retrieving chunks of the stream for further processing.
yield函数可以应用到流生成一个“块”的数据。大块的定义取决于流及其组成部分。一个共同的模式反复调用yield流,检索块流作进一步处理。
作者(S)----------Author(s)----------
Martin Morgan <a href="mtmorgan@fhcrc.org">mtmorgan@fhcrc.org</a>
参见----------See Also----------
Producer, Consumer are the main types of stream components. Use stream to connect components, and yield to iterate a stream.
Producer,Consumer流部件的主要类型。使用stream连接组件,yield迭代流的。
举例----------Examples----------
## About this package[关于这个包]
packageDescription("Streamer")
## Existing stream components[#现有的流组件]
getClass("Producer") # Producer classes[生产者班]
getClass("Consumer") # Consumer classes[消费类]
## An example[#一个例子]
fl <- system.file("extdata", "s_1_sequence.txt", package="Streamer")
b <- RawInput(fl, 100L, reader=rawReaderFactory(1e4))
s <- stream(RawToChar(), Rev(), b)
s
head(yield(s)) # First chunk[第一个块]
b <- RawInput(fl, 5000L, verbose=TRUE)
d <- Downsample(yieldSize=50)
s <- stream(RawToChar(), d, b)
s
s[[2]]
## Processing the first ten chunks of the file[#处理文件的前十位的块]
i <- 1
while (10 >= i && 0L != length(chunk <- yield(s)))
{
cat("chunk", i, "length", length(chunk), "\n")
i <- i + 1
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|