Example of data wrangling in R (part 2)

Load packages

library(tidyverse)

Read yearly_deaths_by_clinic.csv into yearly

yearly <- read_csv("yearly_deaths_by_clinic.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   year = col_double(),
##   births = col_double(),
##   deaths = col_double(),
##   clinic = col_character()
## )

Adding a new column to yearly with proportion of deaths per no. births

yearly <- yearly %>% 
  mutate(proportion_deaths = deaths / births)
Amy Jones
Amy Jones

My research interests include autism, psychosis and alexithymia. matter.

Related