How often do people search for vaccination in the last 5 years?
library(gtrendsR)
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(ggplot2)
plot_trend<-function(val,time_period,title){
google.trends = gtrends(val, gprop = "web", time = time_period,
geo=c("AU"))
Sys.setenv(TZ = "UTC")
interest_by_time=google.trends$interest_over_time
ggplot(aes(x = date, y = hits,color=keyword), data = interest_by_time) +
geom_line(size = 0.5)+ggtitle(title)
}
terms=c('tetanus',
'diphtheria',
'Hib',
'measles',
'mumps')
plot_trend(terms,'all','Trend for diseases we vaccinate against')
MMR and autism any correlation?
Lets check to see how google trends is for diseases that have been eradicated and diseases for which we have new vaccines .
terms=c(
'small pox', #eradicated
'polio', #vaccination program in place
'Hib',#Vaccination program in place
'meningococcal') #New vaccination program in place
plot_trend(terms,'all','Diseases that have been eradicated ,diseases where we have a vaccination program in place ')
Any trends between vaccination, austism,fluoride and GMO
terms=c('vaccination','autism','fluoride','gmo')
plot_trend(terms,'all','gtrends for vaccination,autism,flouride and gmo')
terms=c('meningococcal b','meningococcal c','meningococcal y'
,'meningococcal w','meningococcal a')
plot_trend(terms,'all','Trends of meningococcal')
url<-'https://www1.health.nsw.gov.au/IDD/#/MEN/period/%257B%2522prDisease%2522%253A%2522MEN%2522%252C%2522prLHD%2522%253A%2522X700%252CX710%252CX720%252CX730%252CX740%252CX750%252CX760%252CX770%252CX800%252CX810%252CX820%252CX830%252CX840%252CX850%252CX860%252CX910%2522%252C%2522prReportPeriod%2522%253A%25223%2522%252C%2522prStrain%2522%253A%2522B%252CC%252CNot%2520specified%252CW%252CY%2522%252C%2522prFrom%2522%253A%25221%252F2004%2522%252C%2522prTo%2522%253A%25228%252F2018%2522%257D'
library(rvest)
## Loading required package: xml2
webpage <- read_html(url)
webpage %>% html_nodes('table')
## {xml_nodeset (0)}
webpage
## {xml_document}
## <html lang="en" dir="ltr" class="ms-isBot">
## [1] <head id="ctl00_Head1">\n<!-- Google Tag Manager --><!--Placeholder. ...
## [2] <body onhashchange="if (typeof(_spBodyOnHashChange) != 'undefined') ...
## [3] <script type="text/javascript">\r\n //<![CDATA[\r\n ...