本文介绍了在opencpu会话中访问对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在后续函数调用中访问opencpu会话"中的特定对象?
How do I access a specific object in an opencpu "session" in a subsequent function call?
提出请求,说
/ocpu/library/base/R/eval
带有参数
expr = "x <- 10; y <- 20"
哪个给
/ocpu/tmp/x08dfddafe3/R/.val
/ocpu/tmp/x08dfddafe3/R/x
/ocpu/tmp/x08dfddafe3/R/y
/ocpu/tmp/x08dfddafe3/stdout
/ocpu/tmp/x08dfddafe3/source
/ocpu/tmp/x08dfddafe3/console
/ocpu/tmp/x08dfddafe3/info
现在.val
的值为20.
假设我想将x
传递给
ocpu/library/stats/R/rnorm
有没有一种快速的方法,例如
Is there a quick way to that, something like
n = x08dfddafe3/R/x
在伪"中...
推荐答案
好问题.从版本1.4.4
开始,有两种方法可以实现:
Great question. Starting version 1.4.4
there are two ways of doing this:
- 您可以使用
x08dfddafe3::x
来引用会话x08dfddafe3
的命名空间中的对象x
. - 您可以传递完整的URL http://your.server. com/ocpu/tmp/x08dfddafe3/R/x/rds .如果网络允许,这将自动获取对象并将其反序列化.
- You can use
x08dfddafe3::x
to refer to objectx
in the namespace of sessionx08dfddafe3
. - You can pass the full URL http://your.server.com/ocpu/tmp/x08dfddafe3/R/x/rds. If network permits, this will automaticaly grab the object and unserialize it.
这篇关于在opencpu会话中访问对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!