R is rapidly becoming the standard platform for data manipulation, visualization and analysis and has a number of advantages over other statistical software packages. A wide community of users contribute to R, resulting in an enormous coverage of statistical procedures, including many that are not available in any other statistical program. Furthermore, it is highly flexible for programming and scripting purposes, for example when manipulating data or creating professional plots. However, R lacks standard GUI menus, as in SPSS for example, from which to choose what statistical test to perform or which graph to create. As a consequence, R is more challenging to master. Therefore, this course offers an elaborate introduction into statistical programming in R. Students learn to operate R, make plots, fit, assess and interpret a variety of basic statistical models and do advanced statistical programming and data manipulation. The topics in this course include regression models for linear, dichotomous, ordinal and multivariate data, statistical inference, statistical learning, bootstrapping and Monte Carlo simulation techniques.

Materials covered:

- Installing R/Rstudio or signing up for RStudio Cloud (done at home)
- Getting comfortable with notebooks/projects/scripts
- Getting help
- Variables in R: basic data types (character, numeric, integer, logical, date) and data structures (vectors, matrices, lists, data.frames)
- Filtering using logical operator
- Type conversion (as.integer/as.numeric/as.factor)
- Understanding/installing packages
- Reading a CSV and calculating descriptive statistics
- Data visualization: design and storytelling (slides)[https://github.com/jgarciab/workshop_data_viz]

- Control flow (if-else statements and for loops)
- Functions: creating your own functions
- Principles of tidy data and short comparison of base R and the tidyverse
- Reading and writing files in several formats
- Data wrangling with the tidyverse
- Inferential statistics: A 5-min primer of linear regression
- Reproducible science and dependency management in R
- Best practices in R

Start | End | What? |
---|---|---|

09.15 | 09.30 | Welcome |

09.30 | 10.00 | Lecture |

10:00 | 10.45 | Practical |

10.45 | 11.00 | Discussion |

break | ||

11.00 | 11.45 | Lecture |

11:45 | 12.40 | Practical |

12:40 | 13.00 | Discussion |

`R/RStudio`

Steps: please sign up for RStudio Cloud. Choose the free plan.

`R`

and `RStudio`

from scratchSteps:

- Install
`R`

:`R`

can be obtained here. We won’t use`R`

directly in the course, but rather call`R`

through`RStudio`

. Therefore it needs to be installed.

- Install
- Install
`RStudio`

Desktop: Rstudio is an Integrated Development Environment (IDE). It can be obtained as stand-alone software here. The free and open source`RStudio Desktop`

version is sufficient.

- Install

Steps: see this manual.

- To update
`R`

: The function`updateR()`

in the package`installR`

(Windows) or`updateR`

(Mac) is the easiest route. - To update
`RStudio`

Desktop: Download the new version here.

To ensure that you work with the latest iteration of the course materials, we advice all course participants to access the materials online.

- Part A: Introduction
- Part B: Working with
`R`

: Data types and structures

All lectures are in `html`

format. Practicals are files
that guide you through the exercises. Use the files without solutions
unless you get stuck. Please ask questions to the instructors if
something is not 100% clear.

The above links are useful references that connect to today’s materials.

`rmarkdown`

What is R Markdown? from RStudio, Inc. on Vimeo.

See also this
`rmarkdown`

cheat sheet.

To ensure that you work with the latest iteration of the course materials, we advice all course participants to access the materials online.

- Part C: Programming and reproducibility
- Part D: Tidy R

All lectures are in `html`

format. Practicals are files
that guide you through the exercises. Use the files without solutions
unless you get stuck. Please ask questions to the instructors if
something is not 100% clear.

- The dplyr cheatsheet (mutate, select, etc)
- The tidyr cheatsheet (pivot_longer/wider)
- The purrr cheatsheet (map)
- Data importing and exporting
- The base R cheatsheet
- The tidyverse style guide
- The Google R style guide
- Dependency
management:
`renv`

The above links are useful references that connect to today’s materials.