texteval(session)
texteval()所属R语言包:session
Evaluate string(s) containing R commands and return the text
评估字符串(S)R命令和返回文本
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Evaluate string(s) containing R commands and return the text transcript or printed results
评估字符串(S)R命令和返回的文字记录或打印结果
用法----------Usage----------
capture(expression, collapse=NULL)
texteval(sourceText, collapse=NULL, echo=TRUE)
printed(sourceText, collapse=NULL)
参数----------Arguments----------
参数:expression
R expression to be evaluated
R的表达进行评估
参数:sourceText
Vector of string to be evaluated.
向量的字符串来进行评价。
参数:collapse
Line separator. Defaults to NULL
行分隔符。默认为NULL
参数:echo
Should commands be shown in output. Defaults to TRUE
命令显示输出。默认为TRUE
Details
详细信息----------Details----------
capture captures the results of executing expression using a textConnection. texteval and printed parse and evaluate the contents of sourceText using source and the results are captured using a textConnection. If collapse is NULL, a vector of strings is returned, one element for each line of output. (Empty strings for blank lines). If collapse is non-NULL, the a single character string is formed by pasting the individuals elements together separated by this value. When echo is TRUE, texteval will return a transcript that includes both printed output and evaluated commands. When echo is FALSE, texteval will return only the printed output. printed always returns only the printed output.
capture执行expression使用textConnection捕获结果。 texteval和printed分析和评估的内容的sourceText使用source使用textConnection捕获结果。如果collapse是NULL,返回一个字符串矢量,输出的每一行的一个元素。 (空行空字符串)。如果collapse是一个字符串非NULL,是由粘贴的个人元素,这个值分开。当echo是TRUE,texteval将返回一个成绩单,包括打印输出和评估的命令。当echo是FALSE,texteval将返回唯一的打印输出。 printed总是只返回打印输出。
These functions were created to allow strings provided from external processes (for example by rpy or RSPerl) to be evaluated as if they were scripts.
这些函数创建的,以允许自外部进程(例如RPY或RSPerl所)提供的字符串进行评价,就好像它们是脚本。
值----------Value----------
A single character string if collapse is non-NULL, otherwise a vector of character strings.
单个字符的字符串,如果collapse非NULL,否则一个字符串向量。
(作者)----------Author(s)----------
Gregory R. Warnes <a href="mailto:greg@warnes.net">greg@warnes.net</a>
参见----------See Also----------
source, textConnection, sink, parse, eval
source,textConnection,sink,parse,eval
实例----------Examples----------
# define a script string[定义一个脚本字符串]
script <- "x <- rnorm(100)\ny <- x + rnorm(100,0.25)\nsummary(lm(y~x))"
# evaluate the script string, returning a transcript.[评估的脚本字符串,返回记录。]
result <- texteval(script, "\n")
cat(result)
# evaluate the script string, returning the printed output.[评估的脚本字符串,返回的打印输出。]
result <- printed(script, "\n")
cat(result)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|