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

R语言 Rserve包 Rclient()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-28 21:50:50 | 显示全部楼层 |阅读模式
Rclient(Rserve)
Rclient()所属R语言包:Rserve

                                        Functions to talk to an Rserve
                                         函数来说话的,保有

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

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

Rserve is a server providing R functionality via sockets. The following functions allow another R session to start new Rserve sessions and evaluate commands. The support is very rudimentary and uses only a fraction of the funtionality provided by Rserve. The typical use of Rserve is to connect to other applications, not necessarily to connect two R processes. However, it is not uncommon to have a cluster of Rserve machines so the following functions provide a simple client access.
,保有是通过套接字的服务器提供R功能。以下功能允许另外一个R会话开始新的的,保有会话和评估的命令。该向量是非常基本的,只使用一小部分,所提供的,保有的官能度。典型的使用,保有连接到其他应用程序,而不是一定要连接两个R进程。然而,这是不常见的聚类的,保有机,所以有以下功能提供了一个简单的客户端访问。

For more complete cilent implementation see src/clients directory of the Rserve distribution which show a C/C++ client. Also available from the Rserve pages is a Java client (JRclient). See http://rosuda.org/Rserve for details.
更完整的cilent实施src/clients目录的,保有分布,显示了C / C + +客户端。同样的,保有页是一个Java客户端(JRclient)的。见http://rosuda.org/Rserve的详细信息。


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


RSconnect(host = "localhost", port = 6311)
RSlogin(c, user, pwd, silent = FALSE)
RSeval(c, expr)
RSeval.old(c, cmd)
RSclose(c)
RSshutdown(c, pwd = NULL, ctrl = FALSE)
RSdetach(c)
RSevalDetach(c, cmd = "")
RSattach(session)
RSassign(c, obj, name = deparse(substitute(obj)) )
RSassign.old(c, obj, name = deparse(substitute(obj)) )
RSserverEval(c, expr)
RSserverSource(c, file)



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

参数:host
host to connect to
主机连接到


参数:port
TCP port to connect to
TCP端口连接到


参数:c
Rserve connection
,保有连接


参数:user
username for authentication
用于身份验证的用户名


参数:pwd
password for authentication
密码进行身份验证


参数:cmd
command (as string) to evaluate
命令(如字符串),以评估


参数:silent
flag indicating whether a failure should raise an error or not
失败的标志,指示是否应该引发一个错误或不


参数:session
session object as returned by RSdetach or RSevalDetach
作为返回RSdetach或RSevalDetach,会话对象


参数:obj
value to assign
值分配


参数:name
name to assign to on the remote side
命名要分配给遥控器上的侧


参数:expr
R expression to evaluate remotely
R的表达,以评估远程


参数:file
path to a file on the server(!) that will be sourced into the main instance
一个服务器上的文件的路径(!),将采购到的主要实例


参数:ctrl
logical, if TRUE then control command (CMD_ctrlShutdown) is used for shutdown, otherwise the legacy CMD_shutdown is used instead.
逻辑,如果TRUE然后控制命令(CMD_ctrlShutdown)用于关闭,否则传统的CMD_shutdown来代替。


Details

详细信息----------Details----------

RSconnect creates a connection to a Rserve. The returned handle is to be used in all subsequent calls to client functions. The session associated witht he connection is alive until closed via RSclose.
RSconnect创建一个连接一个,保有。是用于在客户端的功能的所有后续调用返回的句柄。相关的会话witht他连接是活着的,直到关闭通过RSclose。

RSlogin performs authentication with the Rserve. Currently this simple client supports only plain text authentication, encryption is not supported.
RSlogin进行身份验证的,保有。目前,这个简单的客户端只支持纯文本身份验证,加密是不支持的。

RSclose closes the Rserve connection.
RSclose关闭的,保有连接。

RSeval evaluates the supplied expression remotely. expr can be either a string or any R expression. Use quote to use unevaluated expressions. The implementation of RSeval is very efficient in that it does not require any buffer on the remote side and uses native R serialization as the protocol. See exmples below for correct use.
RSeval远程计算所提供的表达式。 expr可以是一个字符串或者任何R的表达。使用quote使用未求值表达式。的执行RSeval“是非常有效的,它不要求任何缓冲区在远程侧,并使用本机ŕ作为协议的序列化。见正确使用exmples以下。

RSeval.old is deprecated and present only for compatibility with older Rserve implementations. It evaluates the string in the remote Rserve and returns the result. Note that you will have to load the same packages on both ends if the result is an (S3/S4) object such that corresponding classes and methods are available. Also note that the result is transported on the network so sending huge results can be slow. Thus consider sending only relebant parts or keep the results on the other end if pertinent.
RSeval.old已被废弃,目前只有带大,保有实现兼容。在远程,保有计算字符串并返回结果。请注意,您必须加载的两端,如果结果是(S3/S4)对象,相应的类和方法是相同的包。另外请注意,其结果是在网络上传送,因此发送庞大的结果可能会很慢。因此,考虑发送仅relebant部分或保持的结果,如果有关的另一端。

RSdetach detaches from the current Rserve connection. The connection is closed but can be restored by using RSattach with the value returned by RSdetach. Technically the R on the other end is still running and waiting to be atached.
RSdetach分离从当前,保有连接。连接被关闭,但可以通过恢复RSattach的RSdetach返回的值。从技术上讲,R的另一端仍在运行,并等待部位,。

RSshutdown terminates the server gracefully. It should be immediately followed by RSclose since the server closes the connection. It can be issued only on a valid (authenticated) connection. The password parameter is currently ignored since password-protected shutdown is not yet supported. Please note that you should not terminate servers that you did not start. More recent Rserve installation can disable regular shutdown and only allow control shutdown (avaiable to control users only) which is invoked by specifying ctrl=TRUE.
RSshutdown终止服务器正常。应该紧跟着RSclose因为服务器关闭连接。它可以是一个有效的连接(认证)才发出。密码参数被忽略,因为尚未支援密码保护关机。请注意,你不应该终止,你没有启动的服务器。最近,保有安装可以禁用定时关机,只允许控制关断(可用来控制用户),这是通过指定ctrl=TRUE的调用。

RSevalDetach same as RSdetach but allows asynchronous evaluation of the command. The remote Rserve is instructed to evaluate the command after the connection is detached. Please note that the session cannot be attached until the evaluation finished. Therefore it is advisable to use another session when attaching to verify the status of the detached session where necessary.
RSevalDetach一样RSdetach的,但允许命令异步的评价。远程连接后,分离,保有指示执行命令。请注意,本次会议不能连接,直至评估完成。因此,它是连接来检验状态的分离会议时,建议使用另一个会话。

RSattach resume connection to an existing session in Rserve. The session argument must have been previously returned from the RSdetach or RSevalDetach comment.
RSattach恢复中,保有现有的会话连接。 session参数必须是先前传回从RSdetach或RSevalDetach评论。

RSassign pushes an object to Rserve and assigns it to the given name. Note that the name can be an (unevaluated) R expression itself thus allowing constructs such as RSassign(c, 1:5,   quote(a$foo)) which will result in a$foo <- 1:5 remotely. However, character names are interpreted literarly.
RSassign推对象,保有和分配给定的名称。请注意该名称可以是一个(未评估)R表达从而使结构如RSassign(c, 1:5,   quote(a$foo))这将导致a$foo <- 1:5远程。然而,字符名称被解释literarly的。

RSserverEval and RSserverSource enqueue commands in the server instance of Rserve, i.e. their effect will be visible for all subsequent client connections. The Rserve instance must have control commands enabled (not the default) in order to allow those commands. RSserverEval evaluates the supplied expression and RSserverSource sources the specified file - it must be a valid path to a file on the server, not the client machine! Both commands are executed asynchronously in the server, so the success of those commands only means that they were queued on the server - they will be executed between subsequent client connections. Note that only subsequent connections will be affected, not the one issuing those commands.
RSserverEval和RSserverSource排队命令的服务器实例,保有,即所有后续的客户端连接,其效果将是可见的。为了让这些命令,保有实例必须有控制命令启用(默认值)。 RSserverEval计算所提供的表达式和RSserverSource源指定的文件 - 它必须是一个有效的路径到一个文件在服务器上,而不是在客户机!在服务器中,这两个命令是异步执行的,所以这些命令的成功不仅意味着他们在服务器上排队 - 它们将被执行随后的客户端之间的连接。请注意,只有后续的连接将受到影响,不发这些命令。


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


Simon Urbanek



实例----------Examples----------


## Not run: [#不运行:]
  c <- RSconnect()
  data(stackloss)
  RSassign(c, stackloss)
  RSeval(c, quote(library(MASS)))
  RSeval(c, quote(rlm(stack.loss ~ ., stackloss)$coeff))
  RSeval(c, "getwd()")
  
  image <- RSeval(c, quote(try({
    attach(stackloss)
    library(Cairo)
    Cairo(file="plot.png")
    plot(Air.Flow,stack.loss,col=2,pch=19,cex=2)
    dev.off()
    readBin("plot.png", "raw", 999999)})))
  if (inherits(image, "try-error"))
    stop(image)

## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-27 12:30 , Processed in 0.031121 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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