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

R语言:seek()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 21:35:57 | 显示全部楼层 |阅读模式
seek(base)
seek()所属R语言包:base

                                        Functions to Reposition Connections
                                         重新定位连接的函数

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

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

Functions to re-position connections.
重新定位连接功能。


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


seek(con, ...)
## S3 method for class 'connection'
seek(con, where = NA, origin = "start", rw = "", ...)

isSeekable(con)

truncate(con, ...)



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

参数:con
a connection.
一个连接。


参数:where
numeric.  A file position (relative to the origin specified by origin), or NA.
数字。文件的位置(相对的起源origin指定),或NA。


参数:rw
character.  Empty or "read" or "write", partial matches allowed.
字符。空或"read"或"write",允许部分匹配。


参数:origin
character.  One of "start", "current", "end": see "Details".
字符。 "start","current","end"一:见“详细资料”。


参数:...
further arguments passed to or from other methods.
通过进一步的论据或其他方法。


Details

详情----------Details----------

seek with where = NA returns the current byte offset of a connection (from the beginning), and with a non-missing where argument the connection is re-positioned (if possible) to the specified position.  isSeekable returns whether the connection in principle supports seek: currently only (possibly gz-compressed) file connections do.
seek与where = NA返回当前的字节偏移量(从一开始)连接,并与非缺失where参数重新定位连接(如果可能的话)到指定的位置。 isSeekable回报是否在原则上的连接支持seek:目前只(可能GZ压缩)文件连接。

where is stored as a real but should represent an integer: non-integer values are likely to be truncated.  Note that the possible values can exceed the largest representable number in an R integer on 64-bit builds, and on some 32-bit builds.
where存储作为一个真正的,但应该代表一个整数:非整数的值可能被截断。请注意,可能的值可以表示的最大数超过一个Rinteger64位版本,和一些32位的版本。

File connections can be open for both writing/appending, in which case R keeps separate positions for reading and writing.  Which seek refers to can be set by its rw argument: the default is the last mode (reading or writing) which was used.  Most files are only opened for reading or writing and so default to that state.  If a file is open for both reading and writing but has not been used, the default is to give the reading position (0).
文件连接,可以打开写入/追加,在这种情况下,继续阅读和写作的独立立场。这seek指rw参数可以设置:默认的是最后一种模式(读或写),这是用来。大多数文件仅打开为读或写等默认为那个状态。如果一个文件是开放的阅读和写作,但一直没有使用,默认的是给阅读位置(0)。

The initial file position for reading is always at the beginning. The initial position for writing is at the beginning of the file for modes "r+" and "r+b", otherwise at the end of the file.  Some platforms only allow writing at the end of the file in the append modes.  (The reported write position for a file opened in an append mode will typically be unreliable until the file has been written to.)
初步阅读文件的位置总是在开始。写作的初始位置是在文件模式"r+"和"r+b",否则在文件的末尾开始。有些平台只允许写在文件中追加模式。 (文件的写入位置开在追加模式,通常是不可靠的,直到该文件已被写入。)

gzfile connections support seek with a number of limitations, using the file position of the uncompressed file. They do not support origin = "end".  When writing, seeking is only possible forwards: when reading seeking backwards is supported by rewinding the file and re-reading from its start.
gzfile连接支持seek一些限制,使用压缩的文件的文件位置。他们不支持origin = "end"。写作时,求是唯一可能的前锋:阅读时寻求向后倒带文件,并从它开始重新阅读支持。

If seek is called with a non-NA value of where, any pushback on a text-mode connection is discarded.
seek如果被称为非NAwhere,任何一个文本模式的连接后推被丢弃的价值。

truncate truncates a file opened for writing at its current position.  It works only for file connections, and is not implemented on all platforms: on others (including Windows) it will not work for large (> 2Gb) files.
truncate截断在其目前的位置以书面形式打开一个文件。它仅适用于file连接,并没有实现所有平台上,对他人(包括Windows)大(> 2GB)文件将无法正常工作。

None of these should be expected to work on text-mode connections with re-encoding selected.
这些都不应预计到文本模式连接选择与重新编码工作。


值----------Value----------

seek returns the current position (before any move), as a (numeric) byte offset from the origin, if relevant, or 0 if not.  Note that the position can exceed the largest representable number in an R integer on 64-bit builds, and on some 32-bit builds.
seek返回当前位置(之前的任何举动),(数字)字节偏移,如果有关的话,从源头或0如果不是。注意的位置可以超过最大数量的R表示integer64位版本,和一些32位的版本。

truncate returns NULL: it stops with an error if it fails (or is not implemented).
truncate返回NULL:停止错误,如果它失败(或不执行)。

isSeekable returns a logical value, whether the connection supports seek.
isSeekable返回一个逻辑值,是否连接支持seek的。


警告----------Warning----------

Use of seek on Windows is discouraged.  We have found so many errors in the Windows implementation of file positioning that users are advised to use it only at their own risk, and asked not to waste the R developers' time with bug reports on Windows' deficiencies.
在Windows上使用seek被劝阻。在Windows实现文件定位,建议用户使用它只能在自己的风险,我们已经发现了这么多的错误,请不要浪费时间与Windows的错误报告的不足之处的R开发。


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

connections
connections

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 21:12 , Processed in 0.023520 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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