connect(Streamer)
connect()所属R语言包:Streamer
Connect Producer and Consumer streams together and return a named list of stream's that the user can invoke the method yield on.
生产者和消费者连接流,并返回一个流,用户可以调用的方法产量上的命名列表。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The function connect can be used to connect Producer and Consumer components together.
可以使用的功能connect连接Producer和Consumer组件连接在一起。
For simple streams, it may be more appropriate to use the stream method. The connect function is useful for connecting together more complex streams involving classes such as YConnector, TConnector, ParallelConnector etc which cannot be handled by the stream method.
对于简单的数据流,它可能更适合使用stream方法。 connect功能是非常有用的连接在一起更复杂的streamS类,如YConnector,TConnector,ParallelConnector等不能处理由stream方法。
The connect function returns a named list of possible streams from the connection information provided by the user. The user can then call yield on the streams to obtain records.
connect函数返回的可能stream的命名列表,由用户提供的连接信息。然后,用户可以调用yield流获得记录。
用法----------Usage----------
connect(blocks, df)
参数----------Arguments----------
参数:blocks
A named list of instances of classes Consumer and Producer to the connected together in a stream
一类Consumer和Producer实例的命名列表连接在一起stream
参数:df
A data.frame with two columns: "from" and "to" which are character vectors corresponding to the names of the blocks. Each row of df describes a connection between Consumer or Producer blocks.
一个data.frame两列:“从”和“到”这是块的名称对应的特征向量。每个df行介绍Consumer或Producer块之间的连接。
Details
详情----------Details----------
Arguments blocks must consist of a named list of a single Producer and zero or more Consumer components.
参数blocks必须由一个单一Producer“零个或更多的Consumer组件的命名列表。
值----------Value----------
A named list of instances of class Stream.
一个名为list类Stream的实例。
作者(S)----------Author(s)----------
Nishant Gopalakrishnan <a href="ngopalak@fhcrc.org">ngopalak@fhcrc.org</a>
参见----------See Also----------
yield,connect,
yield,connect
举例----------Examples----------
### A simple stream involving a Producer and Consumer class [#一个简单的流涉及生产者和消费者类]
fl <- system.file("extdata", "s_1_sequence.txt", package="Streamer")
b <- RawInput(fl, 100L, reader=rawReaderFactory(1e4))
c <- RawToChar(10L)
### Create a named list of the blocks to be connected together[#创建一个名为块列表连接在一起]
blocks <- structure(list(b,c), names = c("b", "c"))
## Create a data.frame that describes the connection between blocks[#创建一个数据框描述块之间的连接]
df <- data.frame(from ="b", to = "c")
res <- connect(blocks, df)
yield(res$c)
reset(res$c)
while (length(yield(res$c))) cat("tick\n")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|