This repository holds an R package, which covers tutorials for a basic introduction to programming and data processing with R. It can be and is used both as self-study material or for tutored e-learning courses.
The tutorials are based on and extending chapters of the following text books
- Statistical Inference via Data Science: A ModernDive into R and the Tidyverse by Chester Ismay and Albert Y. Kim
- R for Data Science by Hadley Wickham and Garrett Grolemund
We thus recommend the following order
- To get started
- R, RStudio, coding, packages = Chapter 1 - 1.3.3 of ModernDive
first-steps
tutorial- The grammar of graphics = Chapter 2.1 of ModernDive
ggplot-basics
tutorial
- Data processing with the
dplyr
package- Workflow basics = Chapter 4 of R4DS
data-tibbles
tutorialdplyr-filter
tutorialdplyr-arrange-select
tutorialdplyr-mutate
tutorialdplyr-groupby-summarize
tutorialdplyr-sundries
tutorial
- Data import/export
data-io
tutorialdata-tidy
tutorial
- String processing
stringr-regex
tutorialstringr-processing
tutorial
- Programming
coding-basics
tutorial
The tutorials are summarized in our Aggregated Cheatsheet.
See below for instructions how to install and run the tutorials.
In order to run the tutorials you need to
- install R (and RStudio) e.g. following this Tutorial Setting Up R
- within R, you need to install the following packages
devtools
- for local tutorial installation of our package from githublearnr
- to run the tutorialstidyverse
- for the packages the tutorials are about- e.g. using
install.packages( c("devtools","learnr","tidyverse") )
Afterwards, you can install or update our tutorial package from github via the following code.
# load packages
library(devtools)
library(learnr)
# install package from source
devtools::install_github("Dr-Eberle-Zentrum/Introduction-to-programming-with-R")
Using packageVersion("deztutr")
, you can check the installed version, which is in YEAR-MONTH-DAY format. The recent version is listed in the DESCRIPTION file.
Note, some tutorials are based on additional data sets, so you better also install the following packages
nycflights13
by simply copying the following code into your console.
install.packages("nycflights13")
Before running the tutorials, you have to load the required packages.
library(learnr) # needed to run the tutorials
library(deztutr) # our package that contains the tutorials
library(tidyverse) # the topic the tutorials are about
Afterwards, you can list the available tutorials via
available_tutorials("deztutr")
or run a specific tutorial using
learnr::run_tutorial("first-steps", package = "deztutr")
Since the tutorial is started within your web browser, you might have to stop the session when you are done with studying the tutorial. This can be done with the red (STOP)-button in the RStudio "R Markdown" pane (upper right corner).
This work by Martin Raden is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
You are more than welcome to contribute and extend!