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: www.r-project.org. 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: https://cloud.r-project.org/bin/windows/base/release.htm.  

 

32-Bit vs. 64-Bit

Since AquaChem is currently only available as a 32-bit application, you will need to install the 32-bit version of R. The 32-bit version of R was recently discontinued in the latest versions of R (see the R-FAQ for details). Future versions of AquaChem will be available as a 64-bit application.  In the meantime, you can download the most recent distribution that does include the 32-bit version at: https://cran.r-project.org/bin/windows/base/old/4.1.3/R-4.1.3-win.exe.

 

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:https://www.waterloohydrogeologic.com/help/aquachem/index.html?installing_r.htm