iai package is a wrapper around the Julia implementation of IAI algorithms, so you need to configure a working Julia installation in addition to installing the R package from CRAN.
Installing Julia and IAI modules
Follow the instructions for installing the IAI system image to get a working Julia installation with the IAI modules included.
For the R interface, you must replace the default system image (Option 1) as there is no way to specify a custom image from inside R
Installing the R package
You can install the R package with
In order to use Julia to run the IAI algorithms, R also needs to know where to find Julia on your computer. We recommend that you specify the location to the Julia installation with the
JULIA_HOME variable. The value of this variable should be the path to the Julia installation folder:
If you are unsure about which directory to use for
JULIA_HOME, you can find the directory by running the following command inside Julia:
The recommended way of specifying
JULIA_HOME is using your
.Renviron file, which can be configured via the
install.packages("usethis") usethis::edit_r_environ(scope = "user")
This will bring up your environ file, which you can edit to specify
JULIA_HOME="the folder that contains julia binary"
Once you restart R, the change will take effect
There are other options for setting
JULIA_HOME that might better suit some scenarios, you can refer to the JuliaCall documentation to see all options.
Alternatively, instead of using
JULIA_HOME, you can add your Julia installation to the system
Using the R package
You can start using the
iai package immediately. The first time you use an IAI function in a new R session, it will automatically initialize the connection to Julia.