LoslegenKostenlos loslegen

Tracking a virus outbreak

You're a doctor in a remote village confronted with a virus outbreak. You have been collecting data on when your patients got infected and recovered in a data frame named patient_df. Your goal is to create a visual with the number of sick patients over time. You'll first have to reshape the data so that you can count the number of sick patients per day.

The data frame has three columns: patient, infected, and recovered.

The dplyr and ggplot2 packages have been pre-loaded for you.

Diese Übung ist Teil des Kurses

Reshaping Data with tidyr

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

patient_df %>% 
  # Pivot the infected and recovered columns to long format
  ___
Code bearbeiten und ausführen