If you haven’t already, I encourage you to read the first article
in my series to gain a basic foundation of R and R Studio. You will also find the links for downloading the programs there as well.
To begin, I want to mention a bit about the “packages” found in R. The incredible thing about R is that is a dynamically evolving language that gains functionality on a daily basis. Packages allow for anyone to compile functions and data sets together in one convenient bundle to extend to the base system functionality of R. There are two main repositories that host packages, CRAN
. At the time of writing this article there are more than 9,000 individual packages available for use with R.
A majority of the packages will be installed from CRAN, so I will highlight the steps to install and load packages hosted there. The first thing you will need to do is to install the package, as an example we will install the ggplot2
(one of R’s most popular graphing packages). Once you have the package installed, you must then load it. The code is as follows:
Alternatively, utilizing R Studio, you can click the Packages tab in the bottom right window, click install, and enter ggplot2 in the Packages field (seen below):
We will be using multiple different packages in this series but I will notify you which ones you need before I expect you to use them, just always remember to load the packages after you install it!
Concept 1: Objects