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.
| Column | Description |
|---|---|
year | Years (1841-1846) |
births | Number of births |
deaths | Number of deaths |
clinic | Clinic 1 or clinic 2 |
monthly_deaths.csv contains data from 'Clinic 1' of the hospital where most deaths occurred.
| Column | Description |
|---|---|
date | Date (YYYY-MM-DD) |
births | Number of births |
deaths | Number of deaths |
# Imported libraries
library(tidyverse)
# Start coding here..1 - Load and inspect the data
# Using read_csv()
yearly <- read_csv('data/yearly_deaths_by_clinic.csv')
monthly <- read_csv('data/monthly_deaths.csv')# Inspecting data
yearly
monthly2 - Add a new column with the proportions
# Calculating the proportion and adding a new column
yearly <- yearly %>%
mutate(proportion_deaths = deaths/births)
head(yearly)
monthly <- monthly %>%
mutate(proportion_deaths = deaths/births)
head(monthly)3 - Make a line plot for each data frame
# Line plot for yearly proportion of deaths by color of clinic
ggplot(yearly, aes(x=year, y=proportion_deaths, color=clinic)) +
geom_line()# Line plot for monthly proportion of deaths
ggplot(monthly, aes(x=date, y=proportion_deaths)) +
geom_line()4 - Visualize the threshold
# Saving the threshold date
threshold_date = as.Date('1847-06-01')# Conditional statement for handwashing
monthly <- monthly %>%
mutate(handwashing_started = date >= threshold_date)
head(monthly)# Line plot for handwashing start date
ggplot(monthly, aes(x=date, y=proportion_deaths, color=handwashing_started)) +
geom_line()