Installation of R for use with Distance 7.3 Release 2
Note these issues occur with earlier versions of Distance too.
Distance makes use of R for analysis engines MRDS, DSM, MA and the simulation engine. You will need to have R installed on your computer to perform analyses with those engines. There are several possible ways in which your installation of R might be incompatible with Distance. This page highlights those challenges and helps you to overcome them.
Distance must ensure these R packages are installed on your system. The packages are shipped with Distance 7.3 and when you attempt to run an MRDS, DSM or MA analysis, or a simulation, Distance checks whether the requisite packages exist, and if not, installs them for you. Distance has certain expectations regarding how to find your installation of R. If those expectations are not met, you will receive various Distance error messages. Below is a guide to the messages, their meaning and remedy.
R installed correctly error
Distance wants to be able to use the 32-bit version of R (there is also a 64-bit version of R, but Distance does not make use of that). If you have installed R, but only the 64-bit version, that is not sufficient. As of this writing, the current version of R is 4.0.2, so this document will presume that is the version of R installed and being used.
Re-install R, making sure the 32-bit version (optionally the 64-bit version) is installed.
Directory not writeable error
Even if you have installed the 32-bit version of R, you may find the R packages needed cannot be installed by Distance. This is the result of security measures put in place by Windows 7 (and later) operating system(s). It is common to make the R library directory in the dreaded C:\Program Files location. Windows 7 (and later) has strong opinions about software writing into that location. The translation of the error message above is : I cannot write the R packages into the usual location because of Windows security concerns.
This is a complex solution. It requires that the location of the directory where the R packages are stored be changed. A common safe location is C:<user>\My Documents\R\win-library See the discussion in the R for Windows FAQ .
The R for Windows FAQ discusses creating an environment variable that points to the location where your R packages will be stored. That requires administrator rights to be able to open the Windows Control Panel, go to Security, System, Advanced Settings. Follow the screen shot shown below.
Following the steps above, you can start Distance again. Attempt to run an MRDS analysis (use the Golftees.dst project shipped with Distance). If all goes as planned, your Log window should produce the following positive messages.