找回密码
 注册
查看: 1069|回复: 0

R语言 Streamer包 RawInput-class()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-26 15:14:49 | 显示全部楼层 |阅读模式
RawInput-class(Streamer)
RawInput-class()所属R语言包:Streamer

                                        Class "RawInput"
                                         类“RawInput”

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

A Producer-class to interpret files as raw (binary) data. Users interact with this class through the constructor RawInput and methods yield, reset, and stream.
一个Producer一流的解释为原料(二进制)数据文件。用户交互通过这个类的构造RawInput和方法yield,reset,stream。

This class requires two helper functions; the "factory" methods defined on this page can be used to supply these. rawReaderFactory creates a "reader", whose responsibility it is to accept a connection and return a vector of predefined type, e.g., raw.  rawParserFactory creates a "parser", responsible for parsing a buffer and vector of the same type as produced by the reader into records. The final record may be incomplete (e.g., because reader does not return complete records), and regardless of completion status is the content of buf on the subsequent invocation of parser. length(buf) or length(bin) may be 0, as when the first or final record is parsed.
这个类需要两个辅助功能;工厂的页面上定义的方法,可以用来提供这些。 rawReaderFactory创建一个“读者”,其职责是接受连接并返回预定义类型的向量,例如,raw。 rawParserFactory创建一个解析器,负责解析相同类型的读者将记录缓冲区和向量。最后记录可能不完整(例如,因为reader不返回完整的记录),无论是完成状态bufparser后续调用的内容。 length(buf)或length(bin)可能是0,当解析的第一个或最后一个记录。


用法----------Usage----------


RawInput(con, yieldSize = 1e+06, reader = rawReaderFactory(),
    parser = rawParserFactory(), ..., verbose = FALSE)
rawReaderFactory(blockSize = 1e+06, what)
rawParserFactory(separator = charToRaw("\n"), trim = separator)



参数----------Arguments----------

参数:con
A character string or connection (opened as "rb" mode) from which raw input will be retrieved.
字符串或连接("rb"模式打开)从原料输入将被检索。


参数:yieldSize
The number of records the input parser is to yield.
输入分析器的记录数是屈服。


参数:reader
A function of one argument (con, an open connection positioned at the start of the file, or at the position the con was in at the end of the previous invocation of the reader function) that returns a vector of type raw.
一个函数的一个参数(con在文件的开始位置,一个开放的连接,或在这个位置上的con在年底以前的读卡器功能调用)返回1向量类型raw。


参数:parser
A function of two arguments (buf, bin), parsing the raw vector c(buf, bin) into records.
一个两个参数的函数(buf,bin),解析rawc(buf, bin)到记录向量。


参数:...
Additional arguments, passed to the $new method of this class. Currently ignored.
额外的参数传递$new这个类的方法。目前被忽略。


参数:verbose
logical(1) indicating whether class methods should report to the user.
logical(1)类的方法是否应该报告给用户。


参数:blockSize
The number of bytes to read at one time.
一次读取的字节数。


参数:what
The type of data to read, as the argument to readBin.
读取的数据类型,作为readBin的参数。


参数:separator
A raw vector indicating the unique sequence of bytes by which record starts are to be recognized. The parser supplied here includes the record separator at the start of each record.
一个raw向量表示独特的字节序列记录开始被认可。这里提供的解析器包括在每条记录开始记录分隔符。


参数:trim
A raw vector that is a prefix of separator, and that is to be removed from the record during parsing.
一个raw向量,是一个前缀separator,而且是在解析过程中,必须从纪录中删除。


领域----------Fields----------




con: Object of class connection. An R connection opened in “rb” mode from which
con类connection的对象。一个Rconnection在“包”模式打开




blockSize: Object of class integer. Size (e.g., number of raw bytes) input during each
blockSize类integer的对象。在每个输入大小(例如,原始字节数)




reader: Object of class function. A function used to input blockSize elements. See
reader类function的对象。函数用来输入blockSize元素。见




parser: Object of class function. A function used to parse raw input into records, e.g., breaking a raw vector on new lines "\n". See
parser类function的对象。用于记录解析到原始输入,例如,打破了上新线的\ nraw向量函数。见




.buffer: Object of class raw. Contains read but
.buffer类raw的对象。包含阅读,但




.records: Object of class list. Parsed but not
.records类list的对象。解析但不




.parsedRecords: Object of class integer. Total
.parsedRecords类integer的对象。总




verbose: Object of class logical. Should
verbose类logical的对象。应该


基于类的方法----------Class-Based Methods----------

verbose):</dt> Called during object creation with values to
详细)</代码>:</ DT>创建对象时调用值




reset(): Remove buffer and current records, reset
reset():删除缓冲区和当前记录,重置




status(): Summarize status of stream.
status():总结流的状态。




yield(): Process stream to yield as many complete records as are represented in the current blockSize
yield():工艺流产生许多完整的记录,表示在当前的blockSize




finalize(): Close con.
finalize():关闭con。


作者(S)----------Author(s)----------


Martin Morgan <a href="mtmorgan@fhcrc.org">mtmorgan@fhcrc.org</a>



参见----------See Also----------

stream, connect
stream,connect


举例----------Examples----------


fl <- system.file("extdata", "s_1_sequence.txt", package="Streamer")
b <- RawInput(fl, 100L, reader=rawReaderFactory(1e4))
yield(b)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 09:20 , Processed in 0.032132 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表