#load library
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
#load data
mea <- read.csv("~/Desktop/ant109_hw1/measles.csv")
Measles is one of the most contagious illness caused by measles virus. It spreads through air or contact with patient’s fluid with no protection. Infected patient could have high fever, red eyes, cough, and rash. Symptoms usually appears 7 to 18 days after exposure. It is a rare illness in recent years with less than 1000 cases per year in the U.S, and it’s mostly thank to measles vaccine. Vaccination is the most effective way of preventing measles. It is recommended to get children injected at a young age. Nowadays, measles vaccine is usually given as MMR vaccine, which protects people from Measles, Mumps, and Rubella.
p1 <- barplot(height = rev(mea$vaccination.coverage), names.arg=rev(mea$year),
xlab="Year",
ylab="Vaccination Coverage(%)",
col=c("#36a5fd"),
bty="l",
main="Measles Vaccination Coverage from 1980 to 2017",
las=1,
ylim=c(0,100))
The graph shown that the coverage rate of measles vaccine has increased tremendously in the 1980s, and maintained at approximately 70% in the 1990s. In the 2000s, it steadily increased to over 80%, and maintained at this level until 2017. The overall trend of measles vaccination coverage from 1980 to 2017 is keep increasing and maintained. However, the coverage rate never reached 90% until 2017, and many people still haven’t get measles vaccine. This may due to lack of knowledge about the disease and vaccine, or lack of access to medical resources. It’s important to continue increasing awareness of getting measles vaccine in the public.
Vaccination has always been a very powerful tool of human against infectious illnesses. It is exceptionally important for preventing illnesses caused by virus, because human still lack direct treatments against viruses that do not only ease symptoms. Measles spreads very easily and quickly, making it hard to stop measles from spreading in between people. This caused vaccination to be the key of preventing measles by protecting individuals. Measles was a large threat to human health, and used to cause millions of deaths. Measles vaccine was first introduced in 1963, and it saved millions of life since then.
mea2<-mea[13:33,] #only year 2005-1985
p2 <- plot_ly(data = mea2,
x = ~vaccination.coverage,
y = ~measles.cases,
type="scatter",
mode="markers",
#the following line of code thanks to panda (panda_express4) in discord
text=~paste("Coverage:",vaccination.coverage,"(%)\n",
"Cases:",measles.cases))%>%
layout(title = 'Vaccination Coverage vs. Measles Cases (1985-2005)',
xaxis = list(title = 'Vaccination Coverage(%)'),
yaxis = list(title = 'Measles Cases')
)
p2
While looking at data of vaccination coverage and measles cases from 1985 to 2005, we could discover that there is a very clear correlation between coverage rate and case number. The higher coverage rate, the less measles cases. Measles vaccine has been very effective of reducing cases when the coverage rate increased from less than 50% to 70%. And cases number remained in the range of 0.5 million to 1 million with 70%-75% coverage rate. This is a strong proof of vaccination’s importance to controlling measles. The scatter points’ distribution also supports prior observation that the coverage rate used to remain at around 70% for years.
barplot(height = (rev(mea$measles.cases))/1000000, names.arg=rev(mea$year),
xlab="Year",
ylab="Measles Cases (by million)",
col=c("#36a5fd"),
bty="l",
main="Measles Vaccination Coverage and Cases from 1980 to 2017",
las=1,
)
par(new=TRUE) #source link: https://www.datacamp.com/tutorial/combining-plots
plot(mea$year,mea$vaccination.coverage,
xlab="Year",
col="red",
bty="l",
type="l",
las=1,
yaxt="n",
ylab="",
xaxt="n",
)
axis(4,at=c(20,40,60,80),line=-1.2,las=1)
title(ylab="Vaccination Coverage (%)", line=-30.8)
legend(x="top", legend=c("Cases","Vaccine Coverage"), fill=c("#36a5fd","red"), bty="n", cex=.5)