This is for a rough guide to install RStudio and to let students get the hang of R and its application with statistics.
R is the name of programming language itself and provides specialised environment for statistical computing and graphics. With R, the application of statistics is made easy and useful, since it provides a wide range of statistical as well as graphical techniques. To see how it fancies, let’s load some data.
library(datasets)
data(airquality)
summary(airquality)
## Ozone Solar.R Wind Temp
## Min. : 1.00 Min. : 7.0 Min. : 1.700 Min. :56.00
## 1st Qu.: 18.00 1st Qu.:115.8 1st Qu.: 7.400 1st Qu.:72.00
## Median : 31.50 Median :205.0 Median : 9.700 Median :79.00
## Mean : 42.13 Mean :185.9 Mean : 9.958 Mean :77.88
## 3rd Qu.: 63.25 3rd Qu.:258.8 3rd Qu.:11.500 3rd Qu.:85.00
## Max. :168.00 Max. :334.0 Max. :20.700 Max. :97.00
## NA's :37 NA's :7
## Month Day
## Min. :5.000 Min. : 1.0
## 1st Qu.:6.000 1st Qu.: 8.0
## Median :7.000 Median :16.0
## Mean :6.993 Mean :15.8
## 3rd Qu.:8.000 3rd Qu.:23.0
## Max. :9.000 Max. :31.0
##
This is the summary of the example dataset “air quality”. As most of you may already know, this is a very much basic function, yet providing statistical summary.
Just imagine if you set a linear regression equation using a certain variable called OLS. Then the “summary” function for OLS will produce much more powerful and detailed statistical summary. With R, we don’t apparently need a “Casio” calculator or something for manual and tedious calculation. I’m not talking about that we don’t even need to study statistics, but about that we can utilise statistics in a much more rapid way. In this regard, R is considered the perfect tool for statistics and data.
With R, students from college of humanities and social science can build up their essay/reports and, of course, dissertation with strong statistical evidence.
With R, statisticians make the world better i.e. with so called “big data”.
With R, you can see the world differently, in a more meaningful way. I would say this is thinking like a statistician
Now then, to utilise R you will obviously need to install R and RStudio, where RStudio is a convinient interface.
Install R: Go to https://cran.r-project.org/ and download R based on your operating system, (Linux, Mac OS, Window).
Install RStudio: Go to https://www.rstudio.com/products/rstudio/download/preview/ and again follow the installer link based on your operating system.
What I have been using R packages in the course of Statistics with R by Duke University is statsr
. Therefore, we need to download and load this package.
Firstly, open RStudio, and type the following commands in the Console:
install.packages("devtools")
library(devtools)
by now, all other packages we will use can be installed.
install.packages("dplsyr")
install.packages("ggplot2")
install.packages("shiny")
install_github("StatWithR/statsr")
The uses of these will be covered over the course of SLICC.