在opencpu会话中访问对象 [英] Accessing objects in opencpu sessions

查看:76
本文介绍了在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:

  • You can use x08dfddafe3::x to refer to object x in the namespace of session x08dfddafe3.
  • 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会话中访问对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆