Add custom parameters to my script

Problem
I can edit the scripts now, I see no way to add custom parameters to my script. The Script Execution Parameters pane always have the same two input fields “Quick Inputs” and “R objects” but the sample scripts that got installed with DeployR (like “DeployR – Hello World.R”) have all kinds of custom parameters in that pane with sliders, etc. How do I add those to my own scripts?
Solution
Assuming you are developing your R scripts in their preferred R IDE, like RStudio, you first need to install the RevoScriptTools package in their R IDE environment.

That R package archive can be found here:

$REVODEPLOYR_HOME/rserve/RScripts/RevoScriptTools_1.0-1.tar.gz

So for example, on a Linux machine following a non-root install that path would look something like this:

/home/deployr-user/deployr/7.1.0/rserve/RScripts/RevoScriptTools_1.0-1.tar.gz

In RStudio just click on the Packages tab in the bottom-right panel and add the package. Or the customer can install the package manually:

R CMD INSTALL RevoScriptTools_1.0-1.tar.gz

Once that package has been installed the you can start using the revoPackage() and revoInput() functions to define package/input dependencies for their scripts.

To view the help for the package just type:

??RevoScriptTools

The help introduces the package and details how to use the revoPackage() and revoInput() functions.

If you uploads a script using these functions into the Repository Manager then the top-right panel under the Test tab will render the desired input controls.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Vlastnosti

ID článku: 3104175 - Poslední kontrola: 10/31/2015 05:13:00 - Revize: 1.0

Revolution Analytics

  • KB3104175
Váš názor