Skip to content

Hungarian physician Dr. Ignaz Semmelweis worked at the Vienna General Hospital with childbed fever patients. Childbed fever is a deadly disease affecting women who have just given birth, and in the early 1840s, as many as 10% of the women giving birth died from it at the Vienna General Hospital. Dr.Semmelweis discovered that it was the contaminated hands of the doctors delivering the babies, and on June 1st, 1847, he decreed that everyone should wash their hands, an unorthodox and controversial request; nobody in Vienna knew about bacteria.

You will reanalyze the data that made Semmelweis discover the importance of handwashing and its impact on the hospital.

The data is stored as two CSV files within the data folder.

yearly_deaths_by_clinic.csv contains the number of women giving birth at the two clinics at the Vienna General Hospital between the years 1841 and 1846.

ColumnDescription
yearYears (1841-1846)
birthsNumber of births
deathsNumber of deaths
clinicClinic 1 or clinic 2

monthly_deaths.csv contains data from 'Clinic 1' of the hospital where most deaths occurred.

ColumnDescription
dateDate (YYYY-MM-DD)
birthsNumber of births
deathsNumber of deaths
# Imported libraries
library(tidyverse)

# Load both csv files into data frames
yearly <- read_csv("data/yearly_deaths_by_clinic.csv")
monthly <- read_csv("data/monthly_deaths.csv")

# Inspect the data frames
yearly
monthly

# Add a column for proportion of deaths to each data frame
yearly <- yearly %>% mutate(proportion_deaths = deaths / births)
monthly <- monthly %>% mutate(proportion_deaths = deaths / births)

# View the updated data frames
yearly
monthly

# Create a line plot showing the proportion of deaths for the yearly data with a different coloured line
# for each clinic
ggplot(yearly, aes(x = year, y = proportion_deaths, color = clinic)) + 
geom_line()

# Create a line plot showing the proportion of deaths for the monthly data
ggplot(monthly, aes(date, proportion_deaths)) + 
geom_line() + 
labs(x = "Year", y = "Proportion Deaths")

# Convert threshold to Date class
threshold <- as.Date("1847-06-01")

# Add a column to the monthly data to show whether handwashing had started on that date
monthly <- monthly %>% mutate(handwashing_started = date >= threshold)

# Plot the new data frame with different coloured lines depending on the handwashing_started column
ggplot(monthly, aes(x = date, y = proportion_deaths, color = handwashing_started)) + 
geom_line()

# Calculate the mean proportion of deaths before + after handwashing
monthly_summary <- monthly %>% group_by(handwashing_started) %>% summarize(mean_prop_deaths = mean(proportion_deaths))

# View the data frame
monthly_summary