Navigation:  Introduction to AquaChem > Installing AquaChem >

Installing R


R is a freely available scripting language and environment for statistical computing developed by the R Foundation and an active user community which provides a vast variety of statistical and graphical procedures.


Getting R

To get started with R, please visit the R homepage: There you will be able to download a copy from one of the members of the Comprehensive R Archive Network (CRAN) and find many resources including the manual and answers to FAQs. AquaChem has been tested with the base version of R for Windows, which is available from many mirror websites, including:  


32-Bit vs. 64-Bit

AquaChem is available as either a 32-bit or 64-bit application.  In order to use the R-Console, you will need to install the same bit-level of R as the installed edition of AquaChem. That is, if you install the 32-bit edition of AquaChem, you will need the 32-bit version of R and if you installed the 64-bit edition of AquaChem, you will need to install the 64-bit version of R. Older versions of R included both a 32-bit and a 64-bit set of files with the installation (as shown below).  Unfortunately, the 32-bit version of R was discontinued in the latest versions of R (see the R-FAQ for details). You can download the most recent distribution that does include the 32-bit version at:


Installing R

By default, R is installed to the directory "C:\Program Files\R"; this can cause problems when you try to install package libraries particularly if you are running scripts in R-Console without Administrative privileges.  For this reason, it is recommended that you install R to a folder that does not require administrative rights (e.g. something like "C:\Languages\R").


Package Libraries

The R scripting language is powerful in its own right; however, it is made significantly more useful by facilitating the use of thousands of external package libraries developed by the wider community; common examples include ggplot2 (which facilitates plotting) and leaflet (which facilitates mapping).

In order to install package libraries from within AquaChem, you will need to call at least one library using a native R interface (e.g. RGui or RStudio). The following steps will guide you through the process of installing your first package which also installs the necessary files for installing more package libraries in AquaChem.


1.Go to the folder where you installed R, by default, this will typically be: C:\Program Files\R\R-4.0.5\bin\i386


2.Double-click the file called: RGui.exe. This will open the graphical user interface (GUI) which is distributed with R:



3.At the prompt, install one package (that you will likely use). For example, you can type:

                       > install.packages('ggplot2')


Please Note: if the package fails to install; a likely cause is that R is attempting to install the library packages to a folder that requires administrative rights.  If this is the case, you can do one of the following:


a.close RGui and reopen it by right-clicking and selecting the "Run as Admin..." option.

b.install R to a local folder that does not require administrative rights

c.set the libPaths option before installing packages in your script. For example if you want to install libraries into "c:\users\user_name\documents\R\libraries", at the beginning of each script you can add:

                       > .libPaths( c( "c:/users/user_name/documents/R/libraries" , .libPaths() )


4.Press <ENTER> to execute the command. You will be prompted to select which of the secure CRAN mirror sites from which you want to download the package:


Once you select a CRAN mirror site for the package, RGui will begin installing the package library along with the prerequisites to install other packages, including in the R-console module in AquaChem. Note that you will be similarly prompted each time you install a package using the install.packages() command in the R-console module within AquaChem.


5.Close RGui.


6.Open AquaChem and select Project > AquaChem Settings from the main menu


7.Select the R-Console tab and set the R location to where the 32-bit version of R.dll is installed on your machine. The default location is:

       C:\Program Files\R\R-4.0.5\bin\i386\R.dll; however, your installation location may be different.


8.Click Apply and OK


You should now be ready to start working with the R-Console in AquaChem.



Page url: