Author

Steen Flammild Harsted & Søren O´Neill

Published

April 25, 2025



1 Presentation

You can download the course slides for this section here

Getting Started

  • Make sure that you are working in your course project
  • Create a new quarto document and name it “missings.qmd”
  • Insert a code chunk and load 2 important libraries
  • Insert a new code chunk- Write source(here("scripts", "01_import.R")) in the chunk
  • Write a short headline to each code chunk
  • Change the YAML header to style your document output.
---
title: "TITLE"
subtitle: "SUBTITLE"
author: "ME"
date: today
format: 
  html:
    toc: true
    toc-depth: 2
    embed-resources: true
    number-sections: true
    number-depth: 2
    code-fold: true
    code-summary: "Show the code"
    code-tools: true
execute:
  message: false
  warning: false
---



1.1 Missing Data



add library(naniar) to the code chunk where you load your libraries

If you need to install naniar:

  • use install.packages("naniar") to download the naniar package.
  • This is done in the console and NOT in your script.



Explore missing values in starwars using

  • vis_miss()
  • gg_miss_upset()
  • What happens if you add , nsets = 6 inside gg_miss_upset()
  • naniar contains more useful functions. You can see them here ::: {.cell}
Show the code
vis_miss(starwars)
gg_miss_upset(starwars)

:::



Explore missing values in the soldiers dataset

Show the code
vis_miss(soldiers)
gg_miss_upset(soldiers)



Improve your home assignment

  • Go back to your home assignment and add a section where you explore missing values
  • Remember to change project (top right corner in Rstudio)
  • Using the menu in the top right corner, you can switch between your course project and your home assignment