Table of Contents

How to use JUICE-R function

JUICE-R function is a way how to run R script directly from JUICE, using data exported from JUICE as an input of R. You need to have both JUICE and R installed on your computer, and JUICE needs to know the directory of R program.

Downloading the JUICE-R script into your computer

You need to get the JUICE-R script and save it to your computer. You may create, e.g. subfolder JUICE-R in the JUICE folder (usually in C:\Program files\JUICE), where you will store all JUICE-R scripts at one place 1). The JUICE-R scripts may be downloaded in Available R scripts link in this website, or in other sources on the internet (if available). They have *.r extension and structure specified in How to write the R script for JUICE link. If you know how to write R scripts, you may write JUICE-R function by yourself.

Launching JUICE-R script from JUICE

If you have the JUICE-R script saved in your computer, open JUICE, and in JUICE menu, go to Analysis > JUICE-R functions, or simply use CTRL+W shortcut. The JUICE-R wizard will open (see Fig. 1 below).

Click on Append R-script and select the *.r file with JUICE-R script in your computer.

If the JUICE-R script contains a header with JUICE-R tags, some of the choices are done automatically, and they will be disabled - in that case, you just click Run. Otherwise, the following choices are available:

In the end, press 'Run' button and the R script will launch.

Figure 1. JUICE-R wizard to run JUICE-R code in R from JUICE.
1)
The folder could be in any folder in your computer which is accessible to you - if you do not have administrator rights and cannot access Program Files folder, create it, e.g. in your Documents.
2)
This means that if you click on Run button in JUICE, JUICE will export the data into the working folder, automatically open R GUI interface and copy (via clipboard) the R code for loading the data and script into R command line. If you interfere in some way with opening R GUI interface (e.g. by opening Excel), it may happen that the R script will be copied elsewhere (e.g. into the Excel), not into R.