R & RStudio

For the purpose of this course we will be requiring R and RStudio. Both are available as open source software for no cost. While R is the mastermind which will interpret our instructions, RStudio will assist us in composing those instructions. Please download R version 4.0.2 from the CRAN website, by clicking here and RStudio Desktop version 1.3, by clicking here.

Each software will guide you through the installation with very simple instructions and if you follow them you should be ready.


Library/package

We do not always have to write our code from scratch. If we find a piece of code in R CRAN repository or on GitHub, after checking the terms of the code release, we can use/adopt the available piece of code in the market, as permitted by the original authors under the terms of the license. Such publicly available collection of R code are generally referred to as a library or a package.

Some packages are distributed with the standard R (~25) you have installed in the earlier step, and some packages you will have to install yourself. For example lets install ggplot2 a very popular plotting package, using the command provided below:

install.packages("ggplot2")

Once installed, lets import it, i.e. tell R we wish to use it. Do note, that this command can be issued at any instance in the code, as long as it is done before using the nice functions from the package:

library(ggplot2)
 

Introduction to R by Dr. Sarath Chandra Dantu

This course material is available under a Creative Commons BY-SA license (CC BY-SA) version 4.0