简体   繁体   English

将用户名作为变量传递并使用deployR返回r脚本的结果

[英]Passing user name as variable and returning the results of r script using deployR

Consider ar script implementing a simple function which returns histogram plot from dataframe in r consisting of three columns say username, monthname and monthly salary. 考虑一个实现简单函数的脚本,该函数从r中的数据帧返回直方图,该直方图由三列组成,分别是用户名,月名和月薪。 Now how to integrate to deployR where a simple http call can pass the parameter of username and get histogram related to that user? 现在如何集成到deployR中,在其中简单的http调用可以传递username的参数并获取与该用户相关的直方图? As I am not a application developer and used to integrate BI Applications using simple http calls with passing username as one of the URL parameters, I want to implement same here. 由于我不是应用程序开发人员,并且习惯于使用简单的http调用并以传递用户名作为URL参数之一来集成BI应用程序,因此我想在此处实现相同的功能。 Any possibility? 有没有可能 say http://url/username=XYZ which returns me the plot for that user. http:// url / username = XYZ ,这给我返回了该用户的图。

Without writing a specific application or a web service acting as a proxy, I don't think it would be possible. 如果不编写特定的应用程序或充当代理的Web服务,我认为这是不可能的。 The reason is that in order to run an R script in DeployR, you need more than one call to the API. 原因是,为了在DeployR中运行R脚本,您需要对API进行多个调用。 This is regardless of the client library you want to use. 这与您要使用的客户端库无关。 You will have to : 你不得不 :

  1. Setup the DeployR session and context execution 设置DeployR会话和上下文执行
  2. Set the parameters 设定参数
  3. Launch the R script 启动R脚本
  4. Get the results 得到结果

As far as I know, it can't be done in one HTTP shot. 据我所知,这不可能一次完成HTTP任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM