通过openCPU本地测试R app [英] Test R app via openCPU localy

查看:199
本文介绍了通过openCPU本地测试R app的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个R包,现在我想提供一个作为Web应用程序的小型演示.为此,我已经编写了一个index.html文件,并将其保存到<pkgRoot>/inst/www/文件夹中.我还安装了opencpu软件包,当我通过localhost:<portNum>/ocpu/test/"Interface"使用它时,它可以很好地工作,在这里我已经可以看到我的软件包并使用Ajax POST和GET请求,以查看该软件包在做什么.

I wrote an R package and now I want to provide let's say a small demo fronted as a webapplication. For this I already wrote a index.html file which I saved to the <pkgRoot>/inst/www/ folder. I also installed the opencpu package which works fine wehen I use it via the localhost:<portNum>/ocpu/test/ "Interface", where I already can see my Package and use the Ajax POST and GET requests in order to see the package is doing what it's ment to do.

但是现在我陷入了某种困境,即我不知道如何测试我自己的应用程序(index.html)的本地设置. localhost:<portNum>/ocpu/<pkgName>/www/index.html不起作用. 据我了解,opencpu随Apache 2一起提供,因此不需要设置额外的Web服务器吗? 据我所知,当我检查安装软件包的路径时,www文件夹以及index.html似乎正是它们应该的位置.

But now im stuck in a sense that I do not know how to test my own app (index.html) localy. localhost:<portNum>/ocpu/<pkgName>/www/index.html does not work. As I understood it, the opencpu Comes with the Apache 2 and hence ist not neccessary to set up an additional webserver? When I check the path to the installed package the www folder as well as the index.html seem to be exactly were they should be, as far as I understand it.

我是否必须通过

opencpu::install_apps("pkgName")

在R内

?因为如果我尝试执行此操作,似乎无法安装本地应用程序,而只能安装在github上托管的应用程序. ....我只想在本地测试应用程序!

inside R? Becaue if I try to do this, it seems there is no way to install local apps but only apps hosted at github. .... and I just want to test the app localy!

真的很高兴有任何建议

推荐答案

只需使用

opencpu::ocpu_start_app("pkgName")

这应该在R中启动HTTP服务器并启动浏览器.

That should start an HTTP server in R and launch your browser.

这篇关于通过openCPU本地测试R app的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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