Scripting engines can be used in two ways on LabKey Server.
  • R, Java or Perl scripts can perform data validation or transformation during assay data upload (see: Transformation Scripts).
  • R scripts can provide advanced data analysis and visualizations for any type of data grid displayed on LabKey Server. For information on using R, see: R Reports. For information on configuring R beyond the instructions below, see: Install and Set Up R.

Add a New Script Engine

  • Sign in to your LabKey Server.
  • Select Admin > Site > Admin Console.
  • Under Configuration, click Views and Scripting.

If the engine you need to use (in this case R) has not yet been added, click on the "Add" button and select "New R Engine" from the drop-down menu. If it has been added already and needs to be configured, select the R engine and then click the "Edit" button instead.

You will then fill in the fields necessary to configure the scripting engine in the popup dialog box. The final state of the box for the R scripting engine for the server appears something like screen capture below:

Name: Choose a name for this engine.

Language: Choose the language of the engine. Example: "R".

File extensions: These extensions will be associate with this scripting engine. Example: For R, choose "R,r" to associate the R engine with both uppercase (.R) and lowercase (.r) extensions.

Program Path: Specify the absolute path of the scripting engine instance on your LabKey Server, including the program itself. Example: The instance of the R program will be named "R.exe" on Windows, but "R" on Unix and Mac machines. Thus, the "Program Path" for the instance of R shown in the screenshot above is "/usr/local/bin/R".

Program Command: This is the command used when the program is invoked.

Example: For R, you would typically will use the default command: "CMD BATCH --slave". The R command is the command used by the LabKey server to execute scripts created in an R view. The default command is sufficient for most cases and usually would not need to be modified.

Output File Name: If the console output is written to a file, the name should be specified here.

Use pandoc and rmarkdown: Enable if you have rmarkdown and pandoc installed. If enabled, Markdown v2 will be used to render knitr R reports; if not enabled, Markdown v1 will be used. See R Reports with knitr

Enabled: Please click this checkbox to enable the engine.

Click "Submit" to save your changes and add the new engine.





expand all collapse all