Preparation: Getting ready

We normally start our R code by loading the required libraries. This is an example of how to load R libraries.

If you haven't installed these libraries yet, you would need to first set a CRAN mirror and then install the libraries using the 'install.packages' function. This can be done via R GUI menus or using R code. The '' files in TERN's DSDP GitHub pages contain information on how install the R libraries required for all tutorials and workshops. The contents of the files are automatically displayed when you navigate to the tutorials and workshops directories (i.e. one directory and file for each tutorial/workshop).

It is also advisable to change your working directory, to a particularly forder you want to use for your the project you are working on. Before running your R scropt for the first time, you might also what to clean the folder by removing unwanted objects. These step can be conducted as shown in the code below. However, the commands are commented out in case that you don't want to conduct all these steps or want to change some details (e.g. change you directory path and name from that provided).