Welcome to the Github repo for the R workshop in KI. This repo contains all necessary material and information for the course.
The course has its own R package, workshop, which aims to make example data and script easily accessible. To install the package, run the following code in R Studio. For more details, please check the 'rpackage' folder.
install.packages("remotes")remotes::install_github("Bolin-Wu/workshopr", subdir = "rpackage", force = TRUE)
This workshop focuses on the beginner level.
This workshop is an extension of workshop in 2022, which focuses on the intermediate level. The topic consists of
- Loop function
- Tidyverse toolkits
- R markdown
Ashley Tate leads this session.
Example code
- View online here
- Get script directly in R
workshopr::get_code_2023(session = "loop")
Bolin Wu introduces useful data manipulation functions in daily work tasks:
- %>% syntax
- join data frames (join function)
- transform data shape (pivot_longer)
- filter variables based on name pattern (select)
- extract the label from DTA and SPSS in R (filter)
- check missing values (summarise & across)
- mutate data based on column types (mutate & across)
- bin variables by percentiles (case_when)
- assign function
Slide
Example code
- View online here
- Get script directly in R
workshopr::get_code_2023(session = "tidyverse").
Bolin Wu explains the basic uses of R markdown and its integration into daily work:
- markdown
- yaml heading
- code chunk options
- live code demo
The slide is here.
To retrieve R markdown templates in R, one can run the following commands in RStudio:
workshopr::get_rmd_2023(name = "pdf_example",output_file = "pdf")
workshopr::get_rmd_2023(name = "word_example",output_file = "word")
workshopr::get_rmd_2023(name = "html_example",output_file = "html")
Get the final exercise here
- 'stringr' and regex (in r) cheatsheet.
- data transformation with 'dplyr' cheatsheet.
- R markdown cheatsheet.