Data110 Assignment W8

Author

Merveille Kuendzong

Published

March 24, 2024

Introduction:

In this Assignment, I use the dataset “us_contagious_diseases” from the “dslabs” package. It contains Yearly counts for Hepatitis A, Measles, Mumps, Pertussis, Polio, Rubella, and Smallpox for US states. Original data courtesy of Tycho Project (http://www.tycho.pitt.edu/).

Load libraries and data

# Load libraries
library(tidyverse)
library("dslabs")
library(highcharter)
library(RColorBrewer)
# data(package="dslabs")

# Load data
data("us_contagious_diseases")

Filter, clean and arrange data

years <- c(1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004)
diseases <- c("Hepatitis A", "Measles", "Mumps", "Pertussis", "Rubella")
 
# Filter data for the state of Maryland for years from 1990 to 2004 for Hepatitis A, Measles, Mumps, Pertussis, and Rubella
my_data <- us_contagious_diseases |>
  filter(state == "Maryland" & year %in% years & disease %in% diseases & !is.na(count))|>
  arrange(year) # Arrange data by year