Installing and Loading 'ausplotsR'


In R to use a library it must be loaded using the 'library' function. To be able to load a library it must have been previouly installed. Boxes with grey background contain code snippets.


The first step to install packages in R is selecting the CRAN (Comprehensive R Archive Network) mirror. Mirror selection and package installation can be done via R’s menu (Packages/Set CRAN mirror… followed by Packages/install package(s)…) or programmatically the via the function 'install.packages' (selecting the CRAN mirror using the argument 'repos'). Typically it is best to choose the cloud mirror (which automatically redirects to an appropriate server worldwide) or a mirror close to you (e.g. in your institution, country,..). A list of Comprehensive R Archive Network (CRAN) mirror URLs can be found here. Bellow are two examples of how to select a CRAN mirrors. In the first example the cloud mirror is selected, and in the second one an Australian mirror is selected. Before running this code you must uncomment (i.e. remove the '#' symbol) the line with the desired mirror. 


## Select the repository (i.e. CRAN mirror URL)
#my.repos = "https://cloud.r-project.org/"
#my.repos = "https://cran.csiro.au/"  # Example of an Australian mirror



Currently ausplotsR must be installed directly from github using the ‘devtools’ package, which must have been previously installed. The code below installs the 'devtools' package. Rather than directly providing the URL for a CRAN mirror, we could have provided the variable 'my.repos' to which we assigned a mirror above. 


## Install directly from github using the 'devtools' package
## Thus, 'devtools' must be previouly installed
install.packages("devtools", repos="https://cloud.r-project.org/")



The next steps are to load the 'devetools' library and install the 'ausplotsR' package from GitHub. The GitHub site for ausplotsR contains the latest developments and information on the package; it can be found at this link.


library(devtools)
install_github("ternaustralia/ausplotsR", build_vignettes = TRUE)



Now the 'ausplotsR' library can be loaded


## Load the package
library(ausplotsR)