parse(base)
parse()所属R语言包:base
Parse Expressions
解析表达式
译者:生物统计家园网 机器人LoveR
描述----------Description----------
parse returns the parsed but unevaluated expressions in a list.
parse返回列表中的解析,但不计算表达式。
用法----------Usage----------
parse(file = "", n = NULL, text = NULL, prompt = "?", srcfile,
encoding = "unknown")
参数----------Arguments----------
参数:file
a connection, or a character string giving the name of a file or a URL to read the expressions from. If file is "" and text is missing or NULL then input is taken from the console.
一个连接,或给出一个文件名或URL读取表达式从一个字符串。如果file是""和text丢失或NULL然后输入从控制台。
参数:n
integer (or coerced to integer). The maximum number of expressions to parse. If n is NULL or negative or NA the input is parsed in its entirety.
整数(或强制转换为整数)。表达式解析的最大数量。如果n是NULL或负或NA输入全部解析。
参数:text
character vector. The text to parse. Elements are treated as if they were lines of a file. Other R objects will be coerced to character if possible.
特征向量。文本解析。元素的处理,好像他们是一个文件的行。如果可能的话,其他研究对象,将被强制转换为字符。
参数:prompt
the prompt to print when parsing from the keyboard. NULL means to use R's prompt, getOption("prompt").
提示打印时,从键盘解析。 NULL意味着使用R的提示,getOption("prompt")。
参数:srcfile
NULL, or a srcfile object. See the "Details" section.
NULL或srcfile对象。看到“详细资料”一节。
参数:encoding
encoding to be assumed for input strings. If the value is "latin1" or "UTF-8" it is used to mark character strings as known to be in Latin-1 or UTF-8: it is not used to re-encode the input. To do the latter, specify the encoding as part of the connection con or via options(encoding=): see the example under file.
假设输入字符串编码。如果该值是"latin1"或"UTF-8"它是用来纪念被称为是在拉丁美洲-1或UTF-8字符串:它不是用来重新编码输入。要做到后者,编码指定为连接con部分或通过options(encoding=)下file看到的例子。
Details
详情----------Details----------
If text has length greater than zero (after coercion) it is used in preference to file.
如果text有长度大于零(胁迫后),它是用来偏好file。
All versions of R accept input from a connection with end of line marked by LF (as used on Unix), CRLF (as used on DOS/Windows) or CR (as used on classic Mac OS). The final line can be incomplete, that is missing the final EOL marker.
R的所有版本都接受来自输入行结束(在Unix上使用)由LF标志着连接,CRLF(DOS / Windows的使用)或CR(如经典的Mac OS)。最后一行可以是不完整的,缺少了最后的EOL标记。
See source for the limits on the size of functions that can be parsed (by default).
看到source可以解析的功能(默认)的大小的限制。
When input is taken from the console, n = NULL is equivalent to n = 1, and n < 0 will read until an EOF character is read. (The EOF character is Ctrl-Z for the Windows front-ends.) The line-length limit is 4095 bytes when reading from the console (which may impose a lower limit: see "An Introduction to R").
当输入控制台,n = NULL是相当于n = 1,n < 0将读取直到EOF字符被读。 (EOF字符是CTRL-Z的Windows前端)。线长度的限制是4095字节,从控制台(可处以下限:见“到R)读取时。
The default for srcfile is set as follows. If options("keep.source") is FALSE, srcfile defaults to NULL. Otherwise, if text is used, srcfile will be set to a srcfilecopy containing the text. If a character string is used for file, a srcfile object referring to that file will be used.
srcfile默认设置如下。如果options("keep.source")是FALSE,srcfile默认NULL。否则,如果text,srcfile将设置一个srcfilecopy包含文本。如果一个字符串用于file,srcfile对象指的是该文件将被使用。
值----------Value----------
An object of type "expression", with up to n elements if specified as a non-negative integer.
"expression",n如果指定的元素作为一个非负整数类型的对象。
When srcfile is non-NULL, a "srcref" attribute will be attached to the result containing a list of srcref records corresponding to each element, a "srcfile" attribute will be attached containing a copy of srcfile, and a "wholeSrcref" attribute will be attached containing a srcref record corresponding to all of the parsed text.
当srcfile非NULL,"srcref"属性将附加到的结果,其中包含了srcref记录每个元素对应,"srcfile"属性列表将附在包含srcfile副本,一个"wholeSrcref"属性将含有srcref解析文本的所有记录相应的附着。
A syntax error (including an incomplete expression) will throw an error.
语法错误(包括不完整的表达)将抛出一个错误。
Character strings in the result will have a declared encoding if encoding is "latin1" or "UTF-8", or if text is supplied with every element of known encoding in a Latin-1 or UTF-8 locale.
结果字符串将有一个声明的编码,如果encoding是"latin1"或"UTF-8",或如果text已知编码的每一个元素提供在拉丁美洲-1 UTF-8语言环境。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
scan, source, eval, deparse.
scan,source,eval,deparse。
举例----------Examples----------
cat("x <- c(1,4)\n x ^ 3 -10 ; outer(1:7,5:9)\n", file="xyz.Rdmped")
# parse 3 statements from the file "xyz.Rdmped"[解析3报表从文件“xyz.Rdmped”]
parse(file = "xyz.Rdmped", n = 3)
unlink("xyz.Rdmped")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|