# install.packages("dslabs") # these are data science labs
library("dslabs")
data(package="dslabs")
list.files(system.file("script", package = "dslabs"))
## [1] "make-admissions.R"
## [2] "make-brca.R"
## [3] "make-brexit_polls.R"
## [4] "make-death_prob.R"
## [5] "make-divorce_margarine.R"
## [6] "make-gapminder-rdas.R"
## [7] "make-greenhouse_gases.R"
## [8] "make-historic_co2.R"
## [9] "make-mnist_27.R"
## [10] "make-movielens.R"
## [11] "make-murders-rda.R"
## [12] "make-na_example-rda.R"
## [13] "make-nyc_regents_scores.R"
## [14] "make-olive.R"
## [15] "make-outlier_example.R"
## [16] "make-polls_2008.R"
## [17] "make-polls_us_election_2016.R"
## [18] "make-reported_heights-rda.R"
## [19] "make-research_funding_rates.R"
## [20] "make-stars.R"
## [21] "make-temp_carbon.R"
## [22] "make-tissue-gene-expression.R"
## [23] "make-trump_tweets.R"
## [24] "make-weekly_us_contagious_diseases.R"
## [25] "save-gapminder-example-csv.R"
I was inspired by the Mark Twain Novel accounts of Mumps in the story “The Adventures Of Huckleberry Finn” by Mark Twain
# load required packages
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(readr)
library(scales)
##
## Attaching package: 'scales'
## The following object is masked from 'package:readr':
##
## col_factor
## Install and Load required packages
# install highcharter, RcolorBrewer
# install.packages("highcharter", "RColorBrewer")
library(highcharter)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
##
## Attaching package: 'highcharter'
## The following object is masked from 'package:dslabs':
##
## stars
library(RColorBrewer)
## Create Huck_finn dataset and process
# Filter out only mumps, measeles, & the state of Missouri
huck_finn <- us_contagious_diseases %>%
mutate(rate = count / population * 10000 * 52 / weeks_reporting) %>%
filter(state%in%c("Missouri")) %>%
filter(disease == "Measles" | disease == "Mumps") %>%
arrange(year)
#basic symbol-and-line chart, default settings
cols <- brewer.pal(4, "RdGy")
highchart() %>%
hc_add_series(data = huck_finn,
type = "line", hcaes(x = year,
y = rate,
group = disease)) %>%
hc_xAxis(title = list(text="Year")) %>%
hc_yAxis(title = list(text="Annual Cases Per 10K In Missouri")) %>%
hc_title(text = "Case Rates For Measles And Mumps in Missouri") %>%
hc_colors(cols)
The graph shows that as early as 1928 Measles was reported in the state of Missouri. It was quite catastrophic until the 1960’s when the vaccine for measles specifically was available. Mumps was not tracked in Missouri until 1968 though the account of the disease was report in Mark Twains novel which was published in 1884 which means this information is not available in this dataset.