Getting Started with R
This is intended to be a quick guide on how to get started with running R for the chapters below.
Downloading R
Download R from the “Comprehensive R Archive Network” CRAN website here
Download R Studio the integraded development environment (IDE) for R here
Getting familliar with the User Interface
You will be using R Studio for your R programs. R Studio provides an intuitive and customizable graphical coding interphase:
To quickly customize apperance, navigate to Tools > Global Options at the top:
Installing Packages
A majority of R programs rely on packages, which are developed by the R community and provide indispensable functionalities to the base program.
For example, the two most common packages I use are tidyverse (actually a collection of packages, for plotting and data manipulation) and data.table (extension of data frame, used for presenting and manipulating datasets). This book was developed specifically with the help of the bookdown package (extension of markdown, for building books).
To install packages, type install.packages(“…”) in the command line (… = name of your package). Personally I recommend installing one package at a time. install.packages(c(“…”,“…”,“…”)) for multiple packages. Note: R is case sensitive.
After installing a package, you need to add it to the library before you are able to use it: library(…). Notice that you dont need "" when adding packages to the library.
To run code in this book, I recommend installing and running the following R packages:
1. tidyverse
2. data.table