3.5 Interface to R

R is a free software environment designed for statistical computing and graphics. Compared to JAGS and OpenBUGS, R has a much more complete programming language and encompasses a vast array of computational and statistical techniques. Nevertheless, it too operates using script files written in its native language, which makes running it in batch mode feasible.

BayESrproject() function provides a convenient interface to R, which allows the user to:

The general syntax of the rproject() function is the following:5

[<structure name> = ] rproject( <R script file> 
        [, "data"=<list of matrices/datasets to pass to R> ] 
        [, "return"=<list of matrices/dataframes to retrieve from R> ] 


As the rproject() function executes, R attempts to print output on the system’s command console. BayES grabs this output and redirects it to the BayES main console in real time. This output is entirely determined by R and the commands contained in the R script file provided to rproject().

The sample script file in "$BayESHOME/Samples/5Interfaces/rproject" contains an example of using the rproject() function, along with a simple R script file. The R interface is also accessible from the BayES main menu via Interfaces R project.

5Arguments inside square brackets are optional. Optional arguments passed to the rproject() function can be provided in any order, but always after the mandatory argument (R script file). Optional arguments always come in pairs (eg. "data"={myDataset,myMatrix}).

Share this content:
Facebook Twitter LinkedIn Email
© 2016–20 Grigorios Emvalomatis