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 a web adapter 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 are 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 login to the server. After that, create a 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 ArcGIS Server account has read and write access to. After that, create a 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 CRAN (Comprehensive R Archive Network) is needed for the packages to be installed successfully. If the server doesn't have Internet access, you need to install all the packages and their dependencies an R script may need into R on the ArcGIS Server machine manually.
Install arcgisbinding
To install arcgisbinding, complete the following steps:
- 1. Download the latest version of arcgisbinding from the r-bridge download from 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 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 following: R_HOME=C:\R_Installation\R-3.5.0.
Known limitations
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 are using more sophisticated data science functions in a distributed environment, or using R_SERVER, some special configurations will need to be set up. Contact Esri Supportfor more details.