Introduction to R
2019-08-30
Introduction
0.1 Requirements
Please install the latest version of R: R version 3.6.1 (2019-07-05)
and RStudio: RStudio Desktop
We will be interacting with R via RStudio, an integrated development environment (IDE). This makes working with R relatively easy.
0.2 What is R?
R is both a programming language and a statistical computing environment. It is open-source, which means that the source code is freely available under the GNU Public License. R is also free to use.
Why is R called R? R was developed as an open-source implementation of the commercial S language. The developers were Ross Ihaka and Robert Gentleman, hence the name R.
The R language can be somewhat tricky to learn. To make life easier, we will be using a family of R packages developed by Hadley Wickham and the RStudio Team.
Even though learning to use a text-based program, such as R, can be a daunting prospect, it is certainly worth the investment. R is currently the state-of-the-art for statistics and data science, and there exist packages for almost every problem.
0.3 Further literature
For anyone interested in a more advanced course, there is an excellent online textbook, R for Data Science, written by Garrett Grolemund und Hadley Wickham. This covers some really advanced topics, such as systematic approaches to model building.
For anyone interested in the R programming language, we recommend the book Hands-On Programming with R by Garrett Grolemund. A very advanced online text book is Advanced R by Hadley Wickham.
DataCamp offer various online courses (not all are free). This introductory course is free.
0.4 Typographic conventions
We will use the following text blocks:
This is for advanced information.
This is for exercises.
This script contains text, as well as R
code. Code chunks look like this:
x <- seq(from = 1, to = 10, by = 1)
This code could also be pasted into a R console. Code chunks can also have an output:
x
#> [1] 1 2 3 4 5 6 7 8 9 10
In this block, x
is the input #> [1] 1 2 3 4 5 6 7 8 9 10
is the output (in this example, we created a variable x
and assigned the numbers 1 to 10 to it).
0.5 License
This work is licensed under a Creative Commons Attribution 4.0 International License.
This is for comments and explanations.