To successfully use an R script tool as a geoprocessing service, the server needs to be set up with R to run the service successfully.
Deployment mode
Regardless of your deployment mode, all servers with ArcGIS Server need to be set up individually. For example, if there is an ArcGIS Web Adaptor in front of a cluster of ArcGIS Server machines, each individual machine with ArcGIS Server needs to be configured.
Install R
On the server, install the latest R under the ArcGIS Server account. The recommended version is Microsoft R 64 bit. For installation instructions, see Microsoft R Application Network.
Install R as an administrator
If you're installing R as an administrator, ensure that the installation directory can be accessed by the ArcGIS Server account. In most cases, an ArcGIS Server account will not have write access to the default installation directory (C:\Program Files).
Install R as the ArcGIS Server account user
You need to use the ArcGIS Server account credentials to log in to the server. Then, create an RIntegration.conf file as described below.
Install R as a general user
An installation-free version is an alternative, if installation on a server machine is restricted or administrator privilege cannot be granted. You can install R on any machine where you have administrator rights, and copy the installed files to the server where the ArcGIS Server account has read and write access. Then, create an RIntegration.conf file as described below.
Package considerations (server and Internet access)
If the script requires additional packages, the ArcGIS Server account needs to be able to install the package into the R directory. Also, an Internet connection with access to the Comprehensive R Archive Network (CRAN) is needed for the packages to be installed successfully. If the server doesn't have Internet access, you need to manually install all the packages and their dependencies that an R script may need into R on the ArcGIS Server machine.
Install arcgisbinding
To install arcgisbinding, complete the following steps:
- 1. Download the latest version of arcgisbinding from the r-bridge download in GitHub.
- 2. Open R on the ArcGIS Server machine by launching \[R install directory]\R-[version]\bin\x64\Rgui.exe.
- 3. In the top menu, choose Packages, choose Install packages from local files, and point to the downloaded .zip file.
Set up the configuration file
In the ArcGIS Server account user folder (\[ArcGIS Server Account User]\AppData\Local\ESRI), create a file named RIntegration.conf. Add R_HOME=[R Installation directory] to this configuration file.
For example, in C:\Users\arcgis\AppData\Local\ESRI\RIntegration.conf, add the R_HOME=C:\R_Installation\R-3.5.0.
Known limitations
Known limitations are noted below.
Running scripts in R on a server machine
If you start R on the server machine and run the code below, an error will occur. However, it will not affect geoprocessing services running and executing R scripts.
Sample code will result an error.
> library(arcgisbinding)
> arc.check_product()
Scripting leveraging distributed environment
If your scripts use sophisticated data science functions in a distributed environment or use R_SERVER, you'll need to set up a special configuration. Contact Esri Support for details.