There is a wide variety of highly contagious viruses around the world that have greatly affected the lives of people for centuries. One of these diseases is Measles, a respiratory illness involving a cough and the development of a rash that can easily spread through the air and by touch. Measles has triggered many epidemics around the world and continues to be an important cause of death globally. However, in the last 30 years, global measles cases have dropped significantly. This graph helps us visualize this, presenting the total reported worldwide cases of measles from 1980 to 2017.
dat <- read.csv("C:/Users/chahi/OneDrive/Desktop/ant109 r docs/measles.csv", stringsAsFactors=TRUE)
barplot(height=dat$measles.cases/1000, names.arg=dat$year, xlab = "Year", ylab = "Measles cases (times 1000)", main = "Worldwide Measles Cases: 1980-2017", col= c("#93bfff"), las=2, ylim = c(0, 5000))
This graph reveals the rapid decline of measles cases around the world
since 1980 up to 2017. During this period of time, the number of cases
peaked at slightly above 4 million in 1981. Between 1981 and 1989, we
can see a sharp decline of cases. However, beginning in the 90s the
amount that cases were decreasing began to level out and in some cases
even increased from previous years. This might be attributed to the
spread of misinformation regarding the vaccine that caused a decrease in
vaccination rates, primarily in the US, Canada, and UK (source 1).
Prior to the development of the Measles vaccine, major epidemics would occur around the world, killing over 2 million people each year at their worst. Thankfully, a vaccine was created in the mid 20th century and since then has been distributed around the globe, saving the lives of countless people. Though the vaccine was officially completed in the 1960s, the World Health Organization didn’t directly target the disease until the middle of the 1970s. This is when they established a program specifically aimed at supporting and expanding vaccination efforts worldwide.
library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
dat2 <- dat[dat$year %in% c(1985:2005),]
p <- plot_ly(data=dat2, x = ~vaccination.coverage, y = ~measles.cases, type="scatter", mode="markers", marker=list(size=10, colors="blue"), text = ~paste('Year:', year)) %>%
layout(xaxis=list(title='Vaccination Coverage (%)'),
yaxis=list(title='Measles Cases'),
title='Measles Cases and Vaccination Coverage (1985-2005)')
p
This graph presents the relationship between vaccination coverage and measles cases around the world from 1985 to 2005. We can clearly see how these vaccination efforts have contributed to the significant drop in measles cases in this 20 year period. It directly shows how as vaccination went up, the amount of measles cases decreased. Though the graph is not linear and shows an increase in cases for some years, the overall trend is evident. This decline of measles cases is probably due to the efforts by the World Health Organization to work with countries around the world to distribute and administer the vaccine.
par(mar=c(4,4,4,4))
barplot(height=dat$measles.cases/1000, names.arg=dat$year, xlab = "Year", ylab = "Measles cases (times 1000)", main = "Worldwide Measles Cases: 1980-2017", col= c("#93bfff"), las=2, ylim = c(0, 5000))
par(new=TRUE)
plot(dat$year, dat$vaccination.coverage, axes=FALSE, xlab = "", ylab = "", type = "l", col = c("red"), lwd=2,)
axis(side=4, ylim=c(0,80), las=1, col="red", col.axis="red")
mtext("Vaccination Coverage (%)", side = 4, col="red", line = 2.5)
legend("right", legend=c("Vaccination Coverage", "Measles Cases"), col=c("red","#93bfff"), lty=1:2, cex=0.8)
For Question 3 I used source 6, a stackoverflow post.
To add an overlaying line graph I used the function par(new=TRUE) and edited the code the poster gave to apply to this data.