First install needed Packages

##install.packages("taskscheduleR")
##library(taskscheduleR)
suppressPackageStartupMessages(library(RCurl))
suppressPackageStartupMessages(library(RJSONIO))
suppressPackageStartupMessages(library(sqldf))
## Warning in doTryCatch(return(expr), name, parentenv, handler): unable to load shared object '/Library/Frameworks/R.framework/Resources/modules//R_X11.so':
##   dlopen(/Library/Frameworks/R.framework/Resources/modules//R_X11.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
##   Referenced from: /Library/Frameworks/R.framework/Resources/modules//R_X11.so
##   Reason: image not found
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(lubridate))
## Warning: package 'lubridate' was built under R version 3.4.4
suppressPackageStartupMessages(library(plyr))
suppressPackageStartupMessages(library(scales))
suppressPackageStartupMessages(library(zoo))
suppressPackageStartupMessages(library(wordcloud))
suppressPackageStartupMessages(library(tm))
## Warning: package 'tm' was built under R version 3.4.3

Part 1: Extract information about Justin Trudeau from the Guardian Media Group API

First we will grab the needed information from the API

## Grab information from the content page
# First build the URL
key<-"9d910bec-dee4-480b-b042-a806eb14738e" ##personal key
##start_date<-"2018-01-01"
page_size<-"200" #number of results per page
url <- paste0("https://content.guardianapis.com/world/justin-trudeau?api-key=", key,
             ## "&from-date=", start_date, 
              "&page-size=", page_size,
              "&page=1")

data_raw<-getURL(url)
data_reformat <- fromJSON(data_raw,nullValue = NA)

#grab results that we want from this data
data_articles<-data_reformat$response$results

##Now find how many pages of content there are (only first page is pulled above)
number_pages<-data_reformat$response$pages


## Now grab data for each following pages (since more than 1) and add to data_articles

for (p in 2:number_pages) #start from second page since first page is already pulled
  {
  url_new <- paste0("https://content.guardianapis.com/world/justin-trudeau?api-key=", key,
               ## "&from-date=", start_date, 
                "&page-size=", page_size,
                "&page=",p)
  
  data_raw_add<-getURL(url_new)
  data_reformat_add<-fromJSON(data_raw_add,nullValue = NA)
  data_articles<-append(data_articles,data_reformat_add$response$results) 
}

Next we will create a dataframe with the resulting data

article_info<-c()
for (a in 1:length(data_articles))
{
  new_row<-cbind(data_articles[[a]]$id,data_articles[[a]]$type 
                 ,data_articles[[a]]$webPublicationDate, data_articles[[a]]$webTitle
                 ,data_articles[[a]]$webUrl, data_articles[[a]]$apiUrl
                 ,data_articles[[a]]$sectionId, data_articles[[a]]$sectionName
                 )
  article_info<-rbind(article_info, new_row)
}

df.article_info<-as.data.frame(article_info)
col_names<-c("id","type","webPublicationDate","webTitle","webUrl","apiUrl", "sectionId","sectionName")

colnames(df.article_info) <-col_names

### Summarize dataframe to see what data is available
summary(df.article_info)
##                                                                                                 id     
##  artanddesign/2016/aug/19/syrian-bassel-mcleash-justin-trudeau                                   :  1  
##  australia-news/2015/oct/23/putin-may-live-to-regret-intervention-in-syria-warns-malcolm-turnbull:  1  
##  business/2015/nov/01/cameron-falters-canada-understands-keynes-trudeau                          :  1  
##  business/2016/mar/15/trump-impact-on-canada-us-trade-relations-nafta-republicans                :  1  
##  business/2016/oct/24/belgium-eu-ultimatum-canada-trade-deal-ceta-wallonia                       :  1  
##  business/2016/oct/30/eu-canada-sign-ceta-free-trade-deal-trudeau-juncker                        :  1  
##  (Other)                                                                                         :389  
##           type                webPublicationDate
##  article    :388   2012-10-04T11:00:02Z:  1     
##  interactive:  1   2013-04-17T11:29:04Z:  1     
##  liveblog   :  6   2015-10-20T12:02:57Z:  1     
##                    2015-10-20T16:17:02Z:  1     
##                    2015-10-20T16:27:29Z:  1     
##                    2015-10-20T16:49:28Z:  1     
##                    (Other)             :389     
##                                                                                                                   webTitle  
##  'Give her whatever she wants': readers on Sophie Grégoire Trudeau's staffing plea | Guardian readers and Sarah Marsh:  1  
##  'He's not a bad person, but â\u0080¦' scandal-hit Justin Trudeau turns voters off                                    :  1  
##  'Heartbreaking': Canadians mourn Iran plane crash victims                                                            :  1  
##  'I need help': Sophie Grégoire Trudeau's plea sparks anger in Canada                                                :  1  
##  'It's like night and day': Trudeau's and Trump's Covid-19 responses fuel wildly different outcomes                   :  1  
##  'Leave Nato': Justin Trudeau pranked by Russian duo posing as Greta Thunberg                                         :  1  
##  (Other)                                                                                                              :389  
##                                                                                                                           webUrl   
##  https://www.theguardian.com/artanddesign/2016/aug/19/syrian-bassel-mcleash-justin-trudeau                                   :  1  
##  https://www.theguardian.com/australia-news/2015/oct/23/putin-may-live-to-regret-intervention-in-syria-warns-malcolm-turnbull:  1  
##  https://www.theguardian.com/business/2015/nov/01/cameron-falters-canada-understands-keynes-trudeau                          :  1  
##  https://www.theguardian.com/business/2016/mar/15/trump-impact-on-canada-us-trade-relations-nafta-republicans                :  1  
##  https://www.theguardian.com/business/2016/oct/24/belgium-eu-ultimatum-canada-trade-deal-ceta-wallonia                       :  1  
##  https://www.theguardian.com/business/2016/oct/30/eu-canada-sign-ceta-free-trade-deal-trudeau-juncker                        :  1  
##  (Other)                                                                                                                     :389  
##                                                                                                                                apiUrl   
##  https://content.guardianapis.com/artanddesign/2016/aug/19/syrian-bassel-mcleash-justin-trudeau                                   :  1  
##  https://content.guardianapis.com/australia-news/2015/oct/23/putin-may-live-to-regret-intervention-in-syria-warns-malcolm-turnbull:  1  
##  https://content.guardianapis.com/business/2015/nov/01/cameron-falters-canada-understands-keynes-trudeau                          :  1  
##  https://content.guardianapis.com/business/2016/mar/15/trump-impact-on-canada-us-trade-relations-nafta-republicans                :  1  
##  https://content.guardianapis.com/business/2016/oct/24/belgium-eu-ultimatum-canada-trade-deal-ceta-wallonia                       :  1  
##  https://content.guardianapis.com/business/2016/oct/30/eu-canada-sign-ceta-free-trade-deal-trudeau-juncker                        :  1  
##  (Other)                                                                                                                          :389  
##          sectionId        sectionName 
##  world        :233   World news :233  
##  commentisfree: 56   Opinion    : 56  
##  environment  : 24   Environment: 24  
##  us-news      : 23   US news    : 23  
##  politics     : 11   Politics   : 11  
##  business     : 10   Business   : 10  
##  (Other)      : 38   (Other)    : 38
##Clean the data
 # we can see entries which are not type = article --> drop these
df.article_info<-df.article_info[df.article_info$type=="article",]
#format date how we need it
df.article_info$webPublicationDate<-substr(df.article_info$webPublicationDate, 1, 10) 

head(df.article_info)
##                                                                                                         id
## 1                             world/2022/may/31/handgun-freeze-in-canada-and-five-round-limit-on-magazines
## 2                                world/2022/may/08/putins-actions-in-ukraine-bring-shame-on-russia-says-g7
## 3                                           money/2022/mar/28/subsidized-childcare-canada-ontario-signs-on
## 4                                        world/2022/mar/22/justin-trudeau-power-sharing-deal-new-democrats
## 5                                          world/2022/feb/20/ottawa-protests-capital-police-clear-blockade
## 6 technology/2022/feb/17/elon-musk-criticised-for-comparing-justin-trudeau-to-adolf-hitler-tweet-auschwitz
##      type webPublicationDate
## 1 article         2022-05-31
## 2 article         2022-05-08
## 3 article         2022-03-28
## 4 article         2022-03-22
## 5 article         2022-02-20
## 6 article         2022-02-17
##                                                                                              webTitle
## 1                                                   Canada plans complete freeze on handgun ownership
## 2                      Putinâ\u0080\u0099s invasion of Ukraine brings shame on Russia, G7 leaders say
## 3 â\u0080\u0098Historic momentâ\u0080\u0099 in Canada as Ontario strikes deal for $10-a-day childcare
## 4                               Justin Trudeau strikes power-sharing deal with leftwing New Democrats
## 5             Ottawa protests: conspiracy theories and accusations of betrayal as police end blockade
## 6                           Elon Musk criticised for likening Justin Trudeau to Adolf Hitler in tweet
##                                                                                                                                 webUrl
## 1                             https://www.theguardian.com/world/2022/may/31/handgun-freeze-in-canada-and-five-round-limit-on-magazines
## 2                                https://www.theguardian.com/world/2022/may/08/putins-actions-in-ukraine-bring-shame-on-russia-says-g7
## 3                                           https://www.theguardian.com/money/2022/mar/28/subsidized-childcare-canada-ontario-signs-on
## 4                                        https://www.theguardian.com/world/2022/mar/22/justin-trudeau-power-sharing-deal-new-democrats
## 5                                          https://www.theguardian.com/world/2022/feb/20/ottawa-protests-capital-police-clear-blockade
## 6 https://www.theguardian.com/technology/2022/feb/17/elon-musk-criticised-for-comparing-justin-trudeau-to-adolf-hitler-tweet-auschwitz
##                                                                                                                                      apiUrl
## 1                             https://content.guardianapis.com/world/2022/may/31/handgun-freeze-in-canada-and-five-round-limit-on-magazines
## 2                                https://content.guardianapis.com/world/2022/may/08/putins-actions-in-ukraine-bring-shame-on-russia-says-g7
## 3                                           https://content.guardianapis.com/money/2022/mar/28/subsidized-childcare-canada-ontario-signs-on
## 4                                        https://content.guardianapis.com/world/2022/mar/22/justin-trudeau-power-sharing-deal-new-democrats
## 5                                          https://content.guardianapis.com/world/2022/feb/20/ottawa-protests-capital-police-clear-blockade
## 6 https://content.guardianapis.com/technology/2022/feb/17/elon-musk-criticised-for-comparing-justin-trudeau-to-adolf-hitler-tweet-auschwitz
##    sectionId sectionName
## 1      world  World news
## 2      world  World news
## 3      world  World news
## 4      world  World news
## 5      world  World news
## 6 technology  Technology

Part 2: Count how many articles about Justin Trudeau have been posted since 01.01.2018 until today

#first we populate all dates within timeframe of interest, since not every day has content
historical_dates<-seq(as.Date("2018-01-01"), Sys.Date(), by="days")
days <- length(historical_dates)

#now we can count how many articles appear each day
daily_article_count<-c()
for (d in 1:days) {
new_day<-cbind(as.character(historical_dates[d]), sum(df.article_info$webPublicationDate==historical_dates[d]))
daily_article_count<-rbind(daily_article_count,new_day)
}

df.daily_article_count<-as.data.frame(daily_article_count)
col_names2<- c("Date", "No. of articles")
colnames(df.daily_article_count) <-col_names2
df.daily_article_count$`No. of articles`<-as.integer(as.character(df.daily_article_count$`No. of articles`))

#show results
print(df.daily_article_count)
##            Date No. of articles
## 1    2018-01-01               0
## 2    2018-01-02               0
## 3    2018-01-03               0
## 4    2018-01-04               0
## 5    2018-01-05               0
## 6    2018-01-06               0
## 7    2018-01-07               0
## 8    2018-01-08               0
## 9    2018-01-09               0
## 10   2018-01-10               1
## 11   2018-01-11               0
## 12   2018-01-12               0
## 13   2018-01-13               0
## 14   2018-01-14               0
## 15   2018-01-15               0
## 16   2018-01-16               0
## 17   2018-01-17               0
## 18   2018-01-18               0
## 19   2018-01-19               0
## 20   2018-01-20               0
## 21   2018-01-21               0
## 22   2018-01-22               0
## 23   2018-01-23               1
## 24   2018-01-24               0
## 25   2018-01-25               0
## 26   2018-01-26               0
## 27   2018-01-27               0
## 28   2018-01-28               0
## 29   2018-01-29               0
## 30   2018-01-30               0
## 31   2018-01-31               0
## 32   2018-02-01               0
## 33   2018-02-02               0
## 34   2018-02-03               0
## 35   2018-02-04               0
## 36   2018-02-05               0
## 37   2018-02-06               0
## 38   2018-02-07               2
## 39   2018-02-08               1
## 40   2018-02-09               1
## 41   2018-02-10               0
## 42   2018-02-11               0
## 43   2018-02-12               0
## 44   2018-02-13               0
## 45   2018-02-14               0
## 46   2018-02-15               0
## 47   2018-02-16               0
## 48   2018-02-17               0
## 49   2018-02-18               1
## 50   2018-02-19               1
## 51   2018-02-20               0
## 52   2018-02-21               0
## 53   2018-02-22               1
## 54   2018-02-23               0
## 55   2018-02-24               0
## 56   2018-02-25               0
## 57   2018-02-26               0
## 58   2018-02-27               0
## 59   2018-02-28               0
## 60   2018-03-01               0
## 61   2018-03-02               1
## 62   2018-03-03               0
## 63   2018-03-04               0
## 64   2018-03-05               0
## 65   2018-03-06               0
## 66   2018-03-07               0
## 67   2018-03-08               0
## 68   2018-03-09               0
## 69   2018-03-10               0
## 70   2018-03-11               0
## 71   2018-03-12               1
## 72   2018-03-13               0
## 73   2018-03-14               0
## 74   2018-03-15               1
## 75   2018-03-16               0
## 76   2018-03-17               0
## 77   2018-03-18               0
## 78   2018-03-19               0
## 79   2018-03-20               0
## 80   2018-03-21               0
## 81   2018-03-22               0
## 82   2018-03-23               0
## 83   2018-03-24               0
## 84   2018-03-25               0
## 85   2018-03-26               1
## 86   2018-03-27               0
## 87   2018-03-28               0
## 88   2018-03-29               0
## 89   2018-03-30               0
## 90   2018-03-31               0
## 91   2018-04-01               0
## 92   2018-04-02               0
## 93   2018-04-03               0
## 94   2018-04-04               0
## 95   2018-04-05               0
## 96   2018-04-06               0
## 97   2018-04-07               0
## 98   2018-04-08               0
## 99   2018-04-09               0
## 100  2018-04-10               0
## 101  2018-04-11               0
## 102  2018-04-12               0
## 103  2018-04-13               0
## 104  2018-04-14               0
## 105  2018-04-15               0
## 106  2018-04-16               3
## 107  2018-04-17               0
## 108  2018-04-18               0
## 109  2018-04-19               0
## 110  2018-04-20               0
## 111  2018-04-21               0
## 112  2018-04-22               0
## 113  2018-04-23               0
## 114  2018-04-24               0
## 115  2018-04-25               0
## 116  2018-04-26               0
## 117  2018-04-27               0
## 118  2018-04-28               0
## 119  2018-04-29               0
## 120  2018-04-30               0
## 121  2018-05-01               0
## 122  2018-05-02               0
## 123  2018-05-03               0
## 124  2018-05-04               1
## 125  2018-05-05               0
## 126  2018-05-06               0
## 127  2018-05-07               0
## 128  2018-05-08               0
## 129  2018-05-09               0
## 130  2018-05-10               0
## 131  2018-05-11               0
## 132  2018-05-12               0
## 133  2018-05-13               0
## 134  2018-05-14               0
## 135  2018-05-15               0
## 136  2018-05-16               1
## 137  2018-05-17               0
## 138  2018-05-18               0
## 139  2018-05-19               0
## 140  2018-05-20               0
## 141  2018-05-21               0
## 142  2018-05-22               0
## 143  2018-05-23               0
## 144  2018-05-24               0
## 145  2018-05-25               0
## 146  2018-05-26               0
## 147  2018-05-27               0
## 148  2018-05-28               0
## 149  2018-05-29               0
## 150  2018-05-30               1
## 151  2018-05-31               1
## 152  2018-06-01               0
## 153  2018-06-02               0
## 154  2018-06-03               1
## 155  2018-06-04               0
## 156  2018-06-05               0
## 157  2018-06-06               1
## 158  2018-06-07               2
## 159  2018-06-08               0
## 160  2018-06-09               1
## 161  2018-06-10               2
## 162  2018-06-11               6
## 163  2018-06-12               2
## 164  2018-06-13               0
## 165  2018-06-14               0
## 166  2018-06-15               0
## 167  2018-06-16               0
## 168  2018-06-17               0
## 169  2018-06-18               0
## 170  2018-06-19               2
## 171  2018-06-20               0
## 172  2018-06-21               1
## 173  2018-06-22               0
## 174  2018-06-23               0
## 175  2018-06-24               0
## 176  2018-06-25               0
## 177  2018-06-26               0
## 178  2018-06-27               0
## 179  2018-06-28               0
## 180  2018-06-29               1
## 181  2018-06-30               1
## 182  2018-07-01               0
## 183  2018-07-02               1
## 184  2018-07-03               0
## 185  2018-07-04               0
## 186  2018-07-05               0
## 187  2018-07-06               2
## 188  2018-07-07               0
## 189  2018-07-08               0
## 190  2018-07-09               0
## 191  2018-07-10               1
## 192  2018-07-11               0
## 193  2018-07-12               0
## 194  2018-07-13               0
## 195  2018-07-14               0
## 196  2018-07-15               0
## 197  2018-07-16               0
## 198  2018-07-17               0
## 199  2018-07-18               0
## 200  2018-07-19               0
## 201  2018-07-20               0
## 202  2018-07-21               0
## 203  2018-07-22               0
## 204  2018-07-23               0
## 205  2018-07-24               0
## 206  2018-07-25               0
## 207  2018-07-26               0
## 208  2018-07-27               0
## 209  2018-07-28               0
## 210  2018-07-29               0
## 211  2018-07-30               0
## 212  2018-07-31               0
## 213  2018-08-01               0
## 214  2018-08-02               0
## 215  2018-08-03               0
## 216  2018-08-04               0
## 217  2018-08-05               0
## 218  2018-08-06               1
## 219  2018-08-07               0
## 220  2018-08-08               0
## 221  2018-08-09               0
## 222  2018-08-10               0
## 223  2018-08-11               0
## 224  2018-08-12               0
## 225  2018-08-13               0
## 226  2018-08-14               0
## 227  2018-08-15               0
## 228  2018-08-16               0
## 229  2018-08-17               0
## 230  2018-08-18               0
## 231  2018-08-19               0
## 232  2018-08-20               0
## 233  2018-08-21               0
## 234  2018-08-22               0
## 235  2018-08-23               0
## 236  2018-08-24               0
## 237  2018-08-25               0
## 238  2018-08-26               0
## 239  2018-08-27               0
## 240  2018-08-28               0
## 241  2018-08-29               0
## 242  2018-08-30               0
## 243  2018-08-31               0
## 244  2018-09-01               0
## 245  2018-09-02               0
## 246  2018-09-03               0
## 247  2018-09-04               0
## 248  2018-09-05               0
## 249  2018-09-06               0
## 250  2018-09-07               0
## 251  2018-09-08               0
## 252  2018-09-09               0
## 253  2018-09-10               0
## 254  2018-09-11               0
## 255  2018-09-12               0
## 256  2018-09-13               0
## 257  2018-09-14               0
## 258  2018-09-15               0
## 259  2018-09-16               0
## 260  2018-09-17               0
## 261  2018-09-18               0
## 262  2018-09-19               0
## 263  2018-09-20               0
## 264  2018-09-21               0
## 265  2018-09-22               0
## 266  2018-09-23               0
## 267  2018-09-24               0
## 268  2018-09-25               0
## 269  2018-09-26               1
## 270  2018-09-27               0
## 271  2018-09-28               1
## 272  2018-09-29               0
## 273  2018-09-30               0
## 274  2018-10-01               0
## 275  2018-10-02               0
## 276  2018-10-03               0
## 277  2018-10-04               0
## 278  2018-10-05               0
## 279  2018-10-06               0
## 280  2018-10-07               0
## 281  2018-10-08               0
## 282  2018-10-09               0
## 283  2018-10-10               1
## 284  2018-10-11               0
## 285  2018-10-12               0
## 286  2018-10-13               0
## 287  2018-10-14               0
## 288  2018-10-15               0
## 289  2018-10-16               0
## 290  2018-10-17               0
## 291  2018-10-18               0
## 292  2018-10-19               0
## 293  2018-10-20               0
## 294  2018-10-21               0
## 295  2018-10-22               0
## 296  2018-10-23               0
## 297  2018-10-24               0
## 298  2018-10-25               0
## 299  2018-10-26               1
## 300  2018-10-27               0
## 301  2018-10-28               0
## 302  2018-10-29               0
## 303  2018-10-30               0
## 304  2018-10-31               0
## 305  2018-11-01               0
## 306  2018-11-02               0
## 307  2018-11-03               0
## 308  2018-11-04               0
## 309  2018-11-05               0
## 310  2018-11-06               0
## 311  2018-11-07               0
## 312  2018-11-08               0
## 313  2018-11-09               0
## 314  2018-11-10               0
## 315  2018-11-11               0
## 316  2018-11-12               1
## 317  2018-11-13               0
## 318  2018-11-14               0
## 319  2018-11-15               0
## 320  2018-11-16               0
## 321  2018-11-17               0
## 322  2018-11-18               0
## 323  2018-11-19               0
## 324  2018-11-20               0
## 325  2018-11-21               0
## 326  2018-11-22               0
## 327  2018-11-23               0
## 328  2018-11-24               0
## 329  2018-11-25               0
## 330  2018-11-26               0
## 331  2018-11-27               0
## 332  2018-11-28               1
## 333  2018-11-29               0
## 334  2018-11-30               1
## 335  2018-12-01               0
## 336  2018-12-02               0
## 337  2018-12-03               0
## 338  2018-12-04               0
## 339  2018-12-05               0
## 340  2018-12-06               0
## 341  2018-12-07               0
## 342  2018-12-08               0
## 343  2018-12-09               0
## 344  2018-12-10               0
## 345  2018-12-11               0
## 346  2018-12-12               0
## 347  2018-12-13               0
## 348  2018-12-14               0
## 349  2018-12-15               0
## 350  2018-12-16               0
## 351  2018-12-17               1
## 352  2018-12-18               0
## 353  2018-12-19               0
## 354  2018-12-20               0
## 355  2018-12-21               0
## 356  2018-12-22               0
## 357  2018-12-23               0
## 358  2018-12-24               0
## 359  2018-12-25               0
## 360  2018-12-26               0
## 361  2018-12-27               0
## 362  2018-12-28               0
## 363  2018-12-29               0
## 364  2018-12-30               0
## 365  2018-12-31               0
## 366  2019-01-01               0
## 367  2019-01-02               1
## 368  2019-01-03               0
## 369  2019-01-04               0
## 370  2019-01-05               0
## 371  2019-01-06               0
## 372  2019-01-07               0
## 373  2019-01-08               0
## 374  2019-01-09               0
## 375  2019-01-10               0
## 376  2019-01-11               1
## 377  2019-01-12               1
## 378  2019-01-13               0
## 379  2019-01-14               0
## 380  2019-01-15               0
## 381  2019-01-16               1
## 382  2019-01-17               0
## 383  2019-01-18               0
## 384  2019-01-19               0
## 385  2019-01-20               0
## 386  2019-01-21               1
## 387  2019-01-22               0
## 388  2019-01-23               0
## 389  2019-01-24               0
## 390  2019-01-25               0
## 391  2019-01-26               0
## 392  2019-01-27               0
## 393  2019-01-28               0
## 394  2019-01-29               0
## 395  2019-01-30               0
## 396  2019-01-31               0
## 397  2019-02-01               0
## 398  2019-02-02               1
## 399  2019-02-03               0
## 400  2019-02-04               0
## 401  2019-02-05               0
## 402  2019-02-06               0
## 403  2019-02-07               0
## 404  2019-02-08               0
## 405  2019-02-09               0
## 406  2019-02-10               0
## 407  2019-02-11               0
## 408  2019-02-12               1
## 409  2019-02-13               0
## 410  2019-02-14               0
## 411  2019-02-15               0
## 412  2019-02-16               0
## 413  2019-02-17               0
## 414  2019-02-18               0
## 415  2019-02-19               0
## 416  2019-02-20               0
## 417  2019-02-21               1
## 418  2019-02-22               0
## 419  2019-02-23               0
## 420  2019-02-24               0
## 421  2019-02-25               0
## 422  2019-02-26               0
## 423  2019-02-27               1
## 424  2019-02-28               2
## 425  2019-03-01               2
## 426  2019-03-02               0
## 427  2019-03-03               0
## 428  2019-03-04               0
## 429  2019-03-05               1
## 430  2019-03-06               0
## 431  2019-03-07               1
## 432  2019-03-08               0
## 433  2019-03-09               0
## 434  2019-03-10               0
## 435  2019-03-11               0
## 436  2019-03-12               0
## 437  2019-03-13               1
## 438  2019-03-14               0
## 439  2019-03-15               0
## 440  2019-03-16               0
## 441  2019-03-17               0
## 442  2019-03-18               1
## 443  2019-03-19               0
## 444  2019-03-20               0
## 445  2019-03-21               1
## 446  2019-03-22               0
## 447  2019-03-23               0
## 448  2019-03-24               0
## 449  2019-03-25               1
## 450  2019-03-26               0
## 451  2019-03-27               0
## 452  2019-03-28               1
## 453  2019-03-29               0
## 454  2019-03-30               0
## 455  2019-03-31               0
## 456  2019-04-01               0
## 457  2019-04-02               0
## 458  2019-04-03               1
## 459  2019-04-04               0
## 460  2019-04-05               0
## 461  2019-04-06               0
## 462  2019-04-07               0
## 463  2019-04-08               0
## 464  2019-04-09               0
## 465  2019-04-10               0
## 466  2019-04-11               0
## 467  2019-04-12               0
## 468  2019-04-13               0
## 469  2019-04-14               0
## 470  2019-04-15               0
## 471  2019-04-16               0
## 472  2019-04-17               0
## 473  2019-04-18               0
## 474  2019-04-19               0
## 475  2019-04-20               0
## 476  2019-04-21               1
## 477  2019-04-22               0
## 478  2019-04-23               0
## 479  2019-04-24               0
## 480  2019-04-25               0
## 481  2019-04-26               0
## 482  2019-04-27               0
## 483  2019-04-28               0
## 484  2019-04-29               0
## 485  2019-04-30               0
## 486  2019-05-01               0
## 487  2019-05-02               0
## 488  2019-05-03               0
## 489  2019-05-04               0
## 490  2019-05-05               0
## 491  2019-05-06               0
## 492  2019-05-07               0
## 493  2019-05-08               0
## 494  2019-05-09               0
## 495  2019-05-10               0
## 496  2019-05-11               0
## 497  2019-05-12               0
## 498  2019-05-13               0
## 499  2019-05-14               1
## 500  2019-05-15               0
## 501  2019-05-16               1
## 502  2019-05-17               1
## 503  2019-05-18               0
## 504  2019-05-19               0
## 505  2019-05-20               0
## 506  2019-05-21               0
## 507  2019-05-22               0
## 508  2019-05-23               0
## 509  2019-05-24               0
## 510  2019-05-25               0
## 511  2019-05-26               0
## 512  2019-05-27               1
## 513  2019-05-28               0
## 514  2019-05-29               0
## 515  2019-05-30               0
## 516  2019-05-31               0
## 517  2019-06-01               0
## 518  2019-06-02               0
## 519  2019-06-03               1
## 520  2019-06-04               0
## 521  2019-06-05               0
## 522  2019-06-06               0
## 523  2019-06-07               0
## 524  2019-06-08               0
## 525  2019-06-09               0
## 526  2019-06-10               0
## 527  2019-06-11               0
## 528  2019-06-12               0
## 529  2019-06-13               0
## 530  2019-06-14               0
## 531  2019-06-15               0
## 532  2019-06-16               0
## 533  2019-06-17               0
## 534  2019-06-18               1
## 535  2019-06-19               0
## 536  2019-06-20               0
## 537  2019-06-21               0
## 538  2019-06-22               1
## 539  2019-06-23               0
## 540  2019-06-24               0
## 541  2019-06-25               0
## 542  2019-06-26               0
## 543  2019-06-27               0
## 544  2019-06-28               0
## 545  2019-06-29               0
## 546  2019-06-30               1
## 547  2019-07-01               0
## 548  2019-07-02               0
## 549  2019-07-03               0
## 550  2019-07-04               0
## 551  2019-07-05               0
## 552  2019-07-06               0
## 553  2019-07-07               0
## 554  2019-07-08               0
## 555  2019-07-09               0
## 556  2019-07-10               0
## 557  2019-07-11               0
## 558  2019-07-12               0
## 559  2019-07-13               0
## 560  2019-07-14               1
## 561  2019-07-15               0
## 562  2019-07-16               0
## 563  2019-07-17               0
## 564  2019-07-18               0
## 565  2019-07-19               1
## 566  2019-07-20               0
## 567  2019-07-21               0
## 568  2019-07-22               0
## 569  2019-07-23               0
## 570  2019-07-24               0
## 571  2019-07-25               0
## 572  2019-07-26               0
## 573  2019-07-27               0
## 574  2019-07-28               0
## 575  2019-07-29               0
## 576  2019-07-30               0
## 577  2019-07-31               0
## 578  2019-08-01               0
## 579  2019-08-02               0
## 580  2019-08-03               0
## 581  2019-08-04               0
## 582  2019-08-05               0
## 583  2019-08-06               0
## 584  2019-08-07               0
## 585  2019-08-08               0
## 586  2019-08-09               0
## 587  2019-08-10               0
## 588  2019-08-11               0
## 589  2019-08-12               0
## 590  2019-08-13               0
## 591  2019-08-14               1
## 592  2019-08-15               0
## 593  2019-08-16               0
## 594  2019-08-17               0
## 595  2019-08-18               0
## 596  2019-08-19               0
## 597  2019-08-20               0
## 598  2019-08-21               0
## 599  2019-08-22               1
## 600  2019-08-23               0
## 601  2019-08-24               0
## 602  2019-08-25               0
## 603  2019-08-26               1
## 604  2019-08-27               0
## 605  2019-08-28               0
## 606  2019-08-29               0
## 607  2019-08-30               0
## 608  2019-08-31               0
## 609  2019-09-01               0
## 610  2019-09-02               0
## 611  2019-09-03               0
## 612  2019-09-04               1
## 613  2019-09-05               1
## 614  2019-09-06               0
## 615  2019-09-07               0
## 616  2019-09-08               0
## 617  2019-09-09               0
## 618  2019-09-10               0
## 619  2019-09-11               1
## 620  2019-09-12               0
## 621  2019-09-13               0
## 622  2019-09-14               0
## 623  2019-09-15               0
## 624  2019-09-16               0
## 625  2019-09-17               0
## 626  2019-09-18               0
## 627  2019-09-19               2
## 628  2019-09-20               4
## 629  2019-09-21               1
## 630  2019-09-22               0
## 631  2019-09-23               1
## 632  2019-09-24               2
## 633  2019-09-25               0
## 634  2019-09-26               1
## 635  2019-09-27               1
## 636  2019-09-28               0
## 637  2019-09-29               0
## 638  2019-09-30               0
## 639  2019-10-01               0
## 640  2019-10-02               0
## 641  2019-10-03               0
## 642  2019-10-04               2
## 643  2019-10-05               0
## 644  2019-10-06               0
## 645  2019-10-07               0
## 646  2019-10-08               1
## 647  2019-10-09               0
## 648  2019-10-10               1
## 649  2019-10-11               0
## 650  2019-10-12               0
## 651  2019-10-13               1
## 652  2019-10-14               0
## 653  2019-10-15               0
## 654  2019-10-16               2
## 655  2019-10-17               0
## 656  2019-10-18               2
## 657  2019-10-19               0
## 658  2019-10-20               0
## 659  2019-10-21               1
## 660  2019-10-22               4
## 661  2019-10-23               1
## 662  2019-10-24               0
## 663  2019-10-25               0
## 664  2019-10-26               0
## 665  2019-10-27               0
## 666  2019-10-28               0
## 667  2019-10-29               0
## 668  2019-10-30               0
## 669  2019-10-31               0
## 670  2019-11-01               0
## 671  2019-11-02               0
## 672  2019-11-03               0
## 673  2019-11-04               0
## 674  2019-11-05               0
## 675  2019-11-06               0
## 676  2019-11-07               0
## 677  2019-11-08               0
## 678  2019-11-09               0
## 679  2019-11-10               0
## 680  2019-11-11               0
## 681  2019-11-12               0
## 682  2019-11-13               0
## 683  2019-11-14               0
## 684  2019-11-15               0
## 685  2019-11-16               0
## 686  2019-11-17               0
## 687  2019-11-18               0
## 688  2019-11-19               0
## 689  2019-11-20               1
## 690  2019-11-21               1
## 691  2019-11-22               0
## 692  2019-11-23               0
## 693  2019-11-24               0
## 694  2019-11-25               0
## 695  2019-11-26               0
## 696  2019-11-27               0
## 697  2019-11-28               0
## 698  2019-11-29               0
## 699  2019-11-30               0
## 700  2019-12-01               0
## 701  2019-12-02               0
## 702  2019-12-03               0
## 703  2019-12-04               3
## 704  2019-12-05               0
## 705  2019-12-06               0
## 706  2019-12-07               0
## 707  2019-12-08               0
## 708  2019-12-09               0
## 709  2019-12-10               0
## 710  2019-12-11               0
## 711  2019-12-12               0
## 712  2019-12-13               0
## 713  2019-12-14               0
## 714  2019-12-15               0
## 715  2019-12-16               0
## 716  2019-12-17               0
## 717  2019-12-18               0
## 718  2019-12-19               0
## 719  2019-12-20               0
## 720  2019-12-21               0
## 721  2019-12-22               0
## 722  2019-12-23               0
## 723  2019-12-24               0
## 724  2019-12-25               0
## 725  2019-12-26               0
## 726  2019-12-27               0
## 727  2019-12-28               0
## 728  2019-12-29               0
## 729  2019-12-30               0
## 730  2019-12-31               0
## 731  2020-01-01               0
## 732  2020-01-02               0
## 733  2020-01-03               0
## 734  2020-01-04               0
## 735  2020-01-05               0
## 736  2020-01-06               0
## 737  2020-01-07               0
## 738  2020-01-08               0
## 739  2020-01-09               4
## 740  2020-01-10               1
## 741  2020-01-11               2
## 742  2020-01-12               0
## 743  2020-01-13               0
## 744  2020-01-14               1
## 745  2020-01-15               0
## 746  2020-01-16               0
## 747  2020-01-17               0
## 748  2020-01-18               0
## 749  2020-01-19               0
## 750  2020-01-20               0
## 751  2020-01-21               0
## 752  2020-01-22               0
## 753  2020-01-23               0
## 754  2020-01-24               1
## 755  2020-01-25               0
## 756  2020-01-26               0
## 757  2020-01-27               0
## 758  2020-01-28               0
## 759  2020-01-29               0
## 760  2020-01-30               0
## 761  2020-01-31               0
## 762  2020-02-01               0
## 763  2020-02-02               0
## 764  2020-02-03               0
## 765  2020-02-04               0
## 766  2020-02-05               0
## 767  2020-02-06               1
## 768  2020-02-07               0
## 769  2020-02-08               0
## 770  2020-02-09               0
## 771  2020-02-10               0
## 772  2020-02-11               0
## 773  2020-02-12               0
## 774  2020-02-13               0
## 775  2020-02-14               0
## 776  2020-02-15               0
## 777  2020-02-16               0
## 778  2020-02-17               0
## 779  2020-02-18               0
## 780  2020-02-19               0
## 781  2020-02-20               0
## 782  2020-02-21               1
## 783  2020-02-22               0
## 784  2020-02-23               0
## 785  2020-02-24               0
## 786  2020-02-25               0
## 787  2020-02-26               0
## 788  2020-02-27               0
## 789  2020-02-28               0
## 790  2020-02-29               0
## 791  2020-03-01               0
## 792  2020-03-02               0
## 793  2020-03-03               0
## 794  2020-03-04               0
## 795  2020-03-05               0
## 796  2020-03-06               0
## 797  2020-03-07               0
## 798  2020-03-08               0
## 799  2020-03-09               0
## 800  2020-03-10               0
## 801  2020-03-11               0
## 802  2020-03-12               0
## 803  2020-03-13               3
## 804  2020-03-14               0
## 805  2020-03-15               0
## 806  2020-03-16               0
## 807  2020-03-17               1
## 808  2020-03-18               1
## 809  2020-03-19               0
## 810  2020-03-20               0
## 811  2020-03-21               0
## 812  2020-03-22               0
## 813  2020-03-23               1
## 814  2020-03-24               0
## 815  2020-03-25               0
## 816  2020-03-26               0
## 817  2020-03-27               0
## 818  2020-03-28               0
## 819  2020-03-29               0
## 820  2020-03-30               0
## 821  2020-03-31               0
## 822  2020-04-01               0
## 823  2020-04-02               0
## 824  2020-04-03               0
## 825  2020-04-04               0
## 826  2020-04-05               0
## 827  2020-04-06               0
## 828  2020-04-07               0
## 829  2020-04-08               0
## 830  2020-04-09               0
## 831  2020-04-10               0
## 832  2020-04-11               0
## 833  2020-04-12               0
## 834  2020-04-13               0
## 835  2020-04-14               1
## 836  2020-04-15               0
## 837  2020-04-16               0
## 838  2020-04-17               0
## 839  2020-04-18               0
## 840  2020-04-19               0
## 841  2020-04-20               2
## 842  2020-04-21               0
## 843  2020-04-22               0
## 844  2020-04-23               0
## 845  2020-04-24               0
## 846  2020-04-25               0
## 847  2020-04-26               0
## 848  2020-04-27               0
## 849  2020-04-28               1
## 850  2020-04-29               0
## 851  2020-04-30               0
## 852  2020-05-01               1
## 853  2020-05-02               0
## 854  2020-05-03               0
## 855  2020-05-04               0
## 856  2020-05-05               0
## 857  2020-05-06               0
## 858  2020-05-07               0
## 859  2020-05-08               0
## 860  2020-05-09               0
## 861  2020-05-10               0
## 862  2020-05-11               0
## 863  2020-05-12               0
## 864  2020-05-13               0
## 865  2020-05-14               0
## 866  2020-05-15               0
## 867  2020-05-16               0
## 868  2020-05-17               0
## 869  2020-05-18               0
## 870  2020-05-19               0
## 871  2020-05-20               1
## 872  2020-05-21               0
## 873  2020-05-22               0
## 874  2020-05-23               0
## 875  2020-05-24               0
## 876  2020-05-25               0
## 877  2020-05-26               1
## 878  2020-05-27               0
## 879  2020-05-28               0
## 880  2020-05-29               1
## 881  2020-05-30               0
## 882  2020-05-31               0
## 883  2020-06-01               0
## 884  2020-06-02               0
## 885  2020-06-03               0
## 886  2020-06-04               0
## 887  2020-06-05               1
## 888  2020-06-06               0
## 889  2020-06-07               0
## 890  2020-06-08               0
## 891  2020-06-09               0
## 892  2020-06-10               0
## 893  2020-06-11               0
## 894  2020-06-12               0
## 895  2020-06-13               0
## 896  2020-06-14               0
## 897  2020-06-15               0
## 898  2020-06-16               0
## 899  2020-06-17               0
## 900  2020-06-18               1
## 901  2020-06-19               0
## 902  2020-06-20               0
## 903  2020-06-21               0
## 904  2020-06-22               0
## 905  2020-06-23               1
## 906  2020-06-24               0
## 907  2020-06-25               0
## 908  2020-06-26               0
## 909  2020-06-27               0
## 910  2020-06-28               0
## 911  2020-06-29               0
## 912  2020-06-30               0
## 913  2020-07-01               0
## 914  2020-07-02               0
## 915  2020-07-03               1
## 916  2020-07-04               0
## 917  2020-07-05               0
## 918  2020-07-06               1
## 919  2020-07-07               0
## 920  2020-07-08               0
## 921  2020-07-09               1
## 922  2020-07-10               1
## 923  2020-07-11               0
## 924  2020-07-12               0
## 925  2020-07-13               0
## 926  2020-07-14               0
## 927  2020-07-15               0
## 928  2020-07-16               0
## 929  2020-07-17               0
## 930  2020-07-18               0
## 931  2020-07-19               0
## 932  2020-07-20               0
## 933  2020-07-21               0
## 934  2020-07-22               0
## 935  2020-07-23               0
## 936  2020-07-24               0
## 937  2020-07-25               0
## 938  2020-07-26               0
## 939  2020-07-27               0
## 940  2020-07-28               0
## 941  2020-07-29               0
## 942  2020-07-30               0
## 943  2020-07-31               0
## 944  2020-08-01               0
## 945  2020-08-02               0
## 946  2020-08-03               0
## 947  2020-08-04               0
## 948  2020-08-05               0
## 949  2020-08-06               0
## 950  2020-08-07               0
## 951  2020-08-08               0
## 952  2020-08-09               0
## 953  2020-08-10               0
## 954  2020-08-11               0
## 955  2020-08-12               0
## 956  2020-08-13               0
## 957  2020-08-14               0
## 958  2020-08-15               1
## 959  2020-08-16               0
## 960  2020-08-17               0
## 961  2020-08-18               3
## 962  2020-08-19               0
## 963  2020-08-20               0
## 964  2020-08-21               0
## 965  2020-08-22               0
## 966  2020-08-23               0
## 967  2020-08-24               0
## 968  2020-08-25               0
## 969  2020-08-26               0
## 970  2020-08-27               0
## 971  2020-08-28               0
## 972  2020-08-29               0
## 973  2020-08-30               0
## 974  2020-08-31               0
## 975  2020-09-01               0
## 976  2020-09-02               0
## 977  2020-09-03               0
## 978  2020-09-04               0
## 979  2020-09-05               0
## 980  2020-09-06               0
## 981  2020-09-07               0
## 982  2020-09-08               0
## 983  2020-09-09               0
## 984  2020-09-10               1
## 985  2020-09-11               0
## 986  2020-09-12               0
## 987  2020-09-13               0
## 988  2020-09-14               0
## 989  2020-09-15               0
## 990  2020-09-16               0
## 991  2020-09-17               0
## 992  2020-09-18               0
## 993  2020-09-19               0
## 994  2020-09-20               0
## 995  2020-09-21               1
## 996  2020-09-22               0
## 997  2020-09-23               1
## 998  2020-09-24               0
## 999  2020-09-25               0
## 1000 2020-09-26               0
## 1001 2020-09-27               0
## 1002 2020-09-28               0
## 1003 2020-09-29               0
## 1004 2020-09-30               0
## 1005 2020-10-01               0
## 1006 2020-10-02               0
## 1007 2020-10-03               0
## 1008 2020-10-04               0
## 1009 2020-10-05               0
## 1010 2020-10-06               0
## 1011 2020-10-07               0
## 1012 2020-10-08               0
## 1013 2020-10-09               0
## 1014 2020-10-10               0
## 1015 2020-10-11               0
## 1016 2020-10-12               0
## 1017 2020-10-13               0
## 1018 2020-10-14               0
## 1019 2020-10-15               0
## 1020 2020-10-16               0
## 1021 2020-10-17               0
## 1022 2020-10-18               0
## 1023 2020-10-19               0
## 1024 2020-10-20               0
## 1025 2020-10-21               0
## 1026 2020-10-22               0
## 1027 2020-10-23               0
## 1028 2020-10-24               0
## 1029 2020-10-25               0
## 1030 2020-10-26               0
## 1031 2020-10-27               2
## 1032 2020-10-28               0
## 1033 2020-10-29               1
## 1034 2020-10-30               0
## 1035 2020-10-31               0
## 1036 2020-11-01               0
## 1037 2020-11-02               0
## 1038 2020-11-03               0
## 1039 2020-11-04               0
## 1040 2020-11-05               0
## 1041 2020-11-06               0
## 1042 2020-11-07               0
## 1043 2020-11-08               0
## 1044 2020-11-09               0
## 1045 2020-11-10               0
## 1046 2020-11-11               0
## 1047 2020-11-12               2
## 1048 2020-11-13               0
## 1049 2020-11-14               0
## 1050 2020-11-15               0
## 1051 2020-11-16               0
## 1052 2020-11-17               0
## 1053 2020-11-18               0
## 1054 2020-11-19               0
## 1055 2020-11-20               0
## 1056 2020-11-21               1
## 1057 2020-11-22               0
## 1058 2020-11-23               0
## 1059 2020-11-24               0
## 1060 2020-11-25               1
## 1061 2020-11-26               0
## 1062 2020-11-27               0
## 1063 2020-11-28               0
## 1064 2020-11-29               0
## 1065 2020-11-30               0
## 1066 2020-12-01               0
## 1067 2020-12-02               0
## 1068 2020-12-03               0
## 1069 2020-12-04               1
## 1070 2020-12-05               0
## 1071 2020-12-06               0
## 1072 2020-12-07               1
## 1073 2020-12-08               0
## 1074 2020-12-09               0
## 1075 2020-12-10               0
## 1076 2020-12-11               0
## 1077 2020-12-12               0
## 1078 2020-12-13               0
## 1079 2020-12-14               0
## 1080 2020-12-15               0
## 1081 2020-12-16               0
## 1082 2020-12-17               0
## 1083 2020-12-18               0
## 1084 2020-12-19               0
## 1085 2020-12-20               0
## 1086 2020-12-21               0
## 1087 2020-12-22               0
## 1088 2020-12-23               0
## 1089 2020-12-24               0
## 1090 2020-12-25               0
## 1091 2020-12-26               0
## 1092 2020-12-27               0
## 1093 2020-12-28               0
## 1094 2020-12-29               0
## 1095 2020-12-30               0
## 1096 2020-12-31               0
## 1097 2021-01-01               0
## 1098 2021-01-02               0
## 1099 2021-01-03               0
## 1100 2021-01-04               0
## 1101 2021-01-05               0
## 1102 2021-01-06               0
## 1103 2021-01-07               0
## 1104 2021-01-08               0
## 1105 2021-01-09               0
## 1106 2021-01-10               0
## 1107 2021-01-11               0
## 1108 2021-01-12               0
## 1109 2021-01-13               0
## 1110 2021-01-14               0
## 1111 2021-01-15               0
## 1112 2021-01-16               0
## 1113 2021-01-17               0
## 1114 2021-01-18               0
## 1115 2021-01-19               0
## 1116 2021-01-20               0
## 1117 2021-01-21               1
## 1118 2021-01-22               0
## 1119 2021-01-23               0
## 1120 2021-01-24               0
## 1121 2021-01-25               0
## 1122 2021-01-26               0
## 1123 2021-01-27               0
## 1124 2021-01-28               0
## 1125 2021-01-29               0
## 1126 2021-01-30               0
## 1127 2021-01-31               0
## 1128 2021-02-01               0
## 1129 2021-02-02               0
## 1130 2021-02-03               0
## 1131 2021-02-04               0
## 1132 2021-02-05               0
## 1133 2021-02-06               0
## 1134 2021-02-07               0
## 1135 2021-02-08               0
## 1136 2021-02-09               1
## 1137 2021-02-10               0
## 1138 2021-02-11               0
## 1139 2021-02-12               0
## 1140 2021-02-13               0
## 1141 2021-02-14               0
## 1142 2021-02-15               0
## 1143 2021-02-16               0
## 1144 2021-02-17               0
## 1145 2021-02-18               0
## 1146 2021-02-19               1
## 1147 2021-02-20               0
## 1148 2021-02-21               0
## 1149 2021-02-22               0
## 1150 2021-02-23               0
## 1151 2021-02-24               0
## 1152 2021-02-25               0
## 1153 2021-02-26               0
## 1154 2021-02-27               0
## 1155 2021-02-28               0
## 1156 2021-03-01               0
## 1157 2021-03-02               0
## 1158 2021-03-03               0
## 1159 2021-03-04               0
## 1160 2021-03-05               0
## 1161 2021-03-06               0
## 1162 2021-03-07               0
## 1163 2021-03-08               0
## 1164 2021-03-09               0
## 1165 2021-03-10               0
## 1166 2021-03-11               0
## 1167 2021-03-12               0
## 1168 2021-03-13               0
## 1169 2021-03-14               0
## 1170 2021-03-15               0
## 1171 2021-03-16               0
## 1172 2021-03-17               0
## 1173 2021-03-18               0
## 1174 2021-03-19               0
## 1175 2021-03-20               0
## 1176 2021-03-21               0
## 1177 2021-03-22               0
## 1178 2021-03-23               0
## 1179 2021-03-24               0
## 1180 2021-03-25               0
## 1181 2021-03-26               0
## 1182 2021-03-27               0
## 1183 2021-03-28               0
## 1184 2021-03-29               1
## 1185 2021-03-30               0
## 1186 2021-03-31               0
## 1187 2021-04-01               0
## 1188 2021-04-02               0
## 1189 2021-04-03               0
## 1190 2021-04-04               0
## 1191 2021-04-05               0
## 1192 2021-04-06               0
## 1193 2021-04-07               0
## 1194 2021-04-08               0
## 1195 2021-04-09               0
## 1196 2021-04-10               0
## 1197 2021-04-11               0
## 1198 2021-04-12               0
## 1199 2021-04-13               0
## 1200 2021-04-14               0
## 1201 2021-04-15               0
## 1202 2021-04-16               0
## 1203 2021-04-17               0
## 1204 2021-04-18               0
## 1205 2021-04-19               0
## 1206 2021-04-20               0
## 1207 2021-04-21               1
## 1208 2021-04-22               0
## 1209 2021-04-23               0
## 1210 2021-04-24               0
## 1211 2021-04-25               0
## 1212 2021-04-26               0
## 1213 2021-04-27               0
## 1214 2021-04-28               0
## 1215 2021-04-29               0
## 1216 2021-04-30               0
## 1217 2021-05-01               0
## 1218 2021-05-02               0
## 1219 2021-05-03               0
## 1220 2021-05-04               0
## 1221 2021-05-05               0
## 1222 2021-05-06               0
## 1223 2021-05-07               0
## 1224 2021-05-08               0
## 1225 2021-05-09               0
## 1226 2021-05-10               0
## 1227 2021-05-11               0
## 1228 2021-05-12               0
## 1229 2021-05-13               0
## 1230 2021-05-14               0
## 1231 2021-05-15               0
## 1232 2021-05-16               0
## 1233 2021-05-17               0
## 1234 2021-05-18               0
## 1235 2021-05-19               0
## 1236 2021-05-20               0
## 1237 2021-05-21               0
## 1238 2021-05-22               0
## 1239 2021-05-23               0
## 1240 2021-05-24               0
## 1241 2021-05-25               0
## 1242 2021-05-26               0
## 1243 2021-05-27               0
## 1244 2021-05-28               0
## 1245 2021-05-29               0
## 1246 2021-05-30               0
## 1247 2021-05-31               0
## 1248 2021-06-01               0
## 1249 2021-06-02               0
## 1250 2021-06-03               0
## 1251 2021-06-04               0
## 1252 2021-06-05               0
## 1253 2021-06-06               0
## 1254 2021-06-07               0
## 1255 2021-06-08               0
## 1256 2021-06-09               0
## 1257 2021-06-10               0
## 1258 2021-06-11               0
## 1259 2021-06-12               0
## 1260 2021-06-13               1
## 1261 2021-06-14               2
## 1262 2021-06-15               0
## 1263 2021-06-16               0
## 1264 2021-06-17               2
## 1265 2021-06-18               0
## 1266 2021-06-19               0
## 1267 2021-06-20               0
## 1268 2021-06-21               0
## 1269 2021-06-22               0
## 1270 2021-06-23               0
## 1271 2021-06-24               0
## 1272 2021-06-25               1
## 1273 2021-06-26               0
## 1274 2021-06-27               0
## 1275 2021-06-28               0
## 1276 2021-06-29               0
## 1277 2021-06-30               1
## 1278 2021-07-01               0
## 1279 2021-07-02               0
## 1280 2021-07-03               0
## 1281 2021-07-04               0
## 1282 2021-07-05               0
## 1283 2021-07-06               1
## 1284 2021-07-07               0
## 1285 2021-07-08               1
## 1286 2021-07-09               0
## 1287 2021-07-10               0
## 1288 2021-07-11               0
## 1289 2021-07-12               0
## 1290 2021-07-13               0
## 1291 2021-07-14               0
## 1292 2021-07-15               0
## 1293 2021-07-16               0
## 1294 2021-07-17               0
## 1295 2021-07-18               0
## 1296 2021-07-19               0
## 1297 2021-07-20               0
## 1298 2021-07-21               0
## 1299 2021-07-22               0
## 1300 2021-07-23               0
## 1301 2021-07-24               0
## 1302 2021-07-25               0
## 1303 2021-07-26               0
## 1304 2021-07-27               0
## 1305 2021-07-28               0
## 1306 2021-07-29               0
## 1307 2021-07-30               0
## 1308 2021-07-31               0
## 1309 2021-08-01               0
## 1310 2021-08-02               0
## 1311 2021-08-03               0
## 1312 2021-08-04               0
## 1313 2021-08-05               0
## 1314 2021-08-06               0
## 1315 2021-08-07               0
## 1316 2021-08-08               0
## 1317 2021-08-09               0
## 1318 2021-08-10               0
## 1319 2021-08-11               0
## 1320 2021-08-12               0
## 1321 2021-08-13               0
## 1322 2021-08-14               0
## 1323 2021-08-15               1
## 1324 2021-08-16               0
## 1325 2021-08-17               0
## 1326 2021-08-18               0
## 1327 2021-08-19               0
## 1328 2021-08-20               0
## 1329 2021-08-21               0
## 1330 2021-08-22               0
## 1331 2021-08-23               1
## 1332 2021-08-24               0
## 1333 2021-08-25               0
## 1334 2021-08-26               0
## 1335 2021-08-27               0
## 1336 2021-08-28               0
## 1337 2021-08-29               0
## 1338 2021-08-30               0
## 1339 2021-08-31               0
## 1340 2021-09-01               0
## 1341 2021-09-02               0
## 1342 2021-09-03               0
## 1343 2021-09-04               0
## 1344 2021-09-05               0
## 1345 2021-09-06               0
## 1346 2021-09-07               0
## 1347 2021-09-08               0
## 1348 2021-09-09               1
## 1349 2021-09-10               1
## 1350 2021-09-11               0
## 1351 2021-09-12               1
## 1352 2021-09-13               0
## 1353 2021-09-14               1
## 1354 2021-09-15               1
## 1355 2021-09-16               0
## 1356 2021-09-17               1
## 1357 2021-09-18               0
## 1358 2021-09-19               1
## 1359 2021-09-20               1
## 1360 2021-09-21               4
## 1361 2021-09-22               0
## 1362 2021-09-23               0
## 1363 2021-09-24               0
## 1364 2021-09-25               0
## 1365 2021-09-26               0
## 1366 2021-09-27               0
## 1367 2021-09-28               0
## 1368 2021-09-29               0
## 1369 2021-09-30               0
## 1370 2021-10-01               0
## 1371 2021-10-02               0
## 1372 2021-10-03               0
## 1373 2021-10-04               0
## 1374 2021-10-05               0
## 1375 2021-10-06               0
## 1376 2021-10-07               0
## 1377 2021-10-08               0
## 1378 2021-10-09               0
## 1379 2021-10-10               0
## 1380 2021-10-11               0
## 1381 2021-10-12               0
## 1382 2021-10-13               0
## 1383 2021-10-14               1
## 1384 2021-10-15               0
## 1385 2021-10-16               0
## 1386 2021-10-17               0
## 1387 2021-10-18               0
## 1388 2021-10-19               0
## 1389 2021-10-20               0
## 1390 2021-10-21               0
## 1391 2021-10-22               0
## 1392 2021-10-23               0
## 1393 2021-10-24               0
## 1394 2021-10-25               0
## 1395 2021-10-26               1
## 1396 2021-10-27               0
## 1397 2021-10-28               0
## 1398 2021-10-29               1
## 1399 2021-10-30               0
## 1400 2021-10-31               0
## 1401 2021-11-01               0
## 1402 2021-11-02               0
## 1403 2021-11-03               0
## 1404 2021-11-04               0
## 1405 2021-11-05               0
## 1406 2021-11-06               0
## 1407 2021-11-07               0
## 1408 2021-11-08               0
## 1409 2021-11-09               0
## 1410 2021-11-10               0
## 1411 2021-11-11               0
## 1412 2021-11-12               0
## 1413 2021-11-13               0
## 1414 2021-11-14               0
## 1415 2021-11-15               0
## 1416 2021-11-16               0
## 1417 2021-11-17               0
## 1418 2021-11-18               0
## 1419 2021-11-19               0
## 1420 2021-11-20               0
## 1421 2021-11-21               0
## 1422 2021-11-22               0
## 1423 2021-11-23               0
## 1424 2021-11-24               0
## 1425 2021-11-25               0
## 1426 2021-11-26               0
## 1427 2021-11-27               0
## 1428 2021-11-28               0
## 1429 2021-11-29               0
## 1430 2021-11-30               0
## 1431 2021-12-01               0
## 1432 2021-12-02               0
## 1433 2021-12-03               0
## 1434 2021-12-04               0
## 1435 2021-12-05               0
## 1436 2021-12-06               0
## 1437 2021-12-07               0
## 1438 2021-12-08               0
## 1439 2021-12-09               0
## 1440 2021-12-10               0
## 1441 2021-12-11               0
## 1442 2021-12-12               0
## 1443 2021-12-13               0
## 1444 2021-12-14               0
## 1445 2021-12-15               0
## 1446 2021-12-16               0
## 1447 2021-12-17               0
## 1448 2021-12-18               0
## 1449 2021-12-19               0
## 1450 2021-12-20               0
## 1451 2021-12-21               0
## 1452 2021-12-22               0
## 1453 2021-12-23               0
## 1454 2021-12-24               0
## 1455 2021-12-25               0
## 1456 2021-12-26               0
## 1457 2021-12-27               0
## 1458 2021-12-28               0
## 1459 2021-12-29               0
## 1460 2021-12-30               0
## 1461 2021-12-31               0
## 1462 2022-01-01               0
## 1463 2022-01-02               0
## 1464 2022-01-03               0
## 1465 2022-01-04               0
## 1466 2022-01-05               0
## 1467 2022-01-06               0
## 1468 2022-01-07               0
## 1469 2022-01-08               0
## 1470 2022-01-09               0
## 1471 2022-01-10               0
## 1472 2022-01-11               0
## 1473 2022-01-12               0
## 1474 2022-01-13               0
## 1475 2022-01-14               0
## 1476 2022-01-15               0
## 1477 2022-01-16               0
## 1478 2022-01-17               0
## 1479 2022-01-18               0
## 1480 2022-01-19               0
## 1481 2022-01-20               0
## 1482 2022-01-21               0
## 1483 2022-01-22               0
## 1484 2022-01-23               0
## 1485 2022-01-24               0
## 1486 2022-01-25               0
## 1487 2022-01-26               0
## 1488 2022-01-27               0
## 1489 2022-01-28               0
## 1490 2022-01-29               0
## 1491 2022-01-30               0
## 1492 2022-01-31               0
## 1493 2022-02-01               0
## 1494 2022-02-02               0
## 1495 2022-02-03               0
## 1496 2022-02-04               0
## 1497 2022-02-05               0
## 1498 2022-02-06               0
## 1499 2022-02-07               0
## 1500 2022-02-08               0
## 1501 2022-02-09               0
## 1502 2022-02-10               0
## 1503 2022-02-11               0
## 1504 2022-02-12               0
## 1505 2022-02-13               0
## 1506 2022-02-14               1
## 1507 2022-02-15               0
## 1508 2022-02-16               1
## 1509 2022-02-17               1
## 1510 2022-02-18               0
## 1511 2022-02-19               0
## 1512 2022-02-20               1
## 1513 2022-02-21               0
## 1514 2022-02-22               0
## 1515 2022-02-23               0
## 1516 2022-02-24               0
## 1517 2022-02-25               0
## 1518 2022-02-26               0
## 1519 2022-02-27               0
## 1520 2022-02-28               0
## 1521 2022-03-01               0
## 1522 2022-03-02               0
## 1523 2022-03-03               0
## 1524 2022-03-04               0
## 1525 2022-03-05               0
## 1526 2022-03-06               0
## 1527 2022-03-07               0
## 1528 2022-03-08               0
## 1529 2022-03-09               0
## 1530 2022-03-10               0
## 1531 2022-03-11               0
## 1532 2022-03-12               0
## 1533 2022-03-13               0
## 1534 2022-03-14               0
## 1535 2022-03-15               0
## 1536 2022-03-16               0
## 1537 2022-03-17               0
## 1538 2022-03-18               0
## 1539 2022-03-19               0
## 1540 2022-03-20               0
## 1541 2022-03-21               0
## 1542 2022-03-22               1
## 1543 2022-03-23               0
## 1544 2022-03-24               0
## 1545 2022-03-25               0
## 1546 2022-03-26               0
## 1547 2022-03-27               0
## 1548 2022-03-28               1
## 1549 2022-03-29               0
## 1550 2022-03-30               0
## 1551 2022-03-31               0
## 1552 2022-04-01               0
## 1553 2022-04-02               0
## 1554 2022-04-03               0
## 1555 2022-04-04               0
## 1556 2022-04-05               0
## 1557 2022-04-06               0
## 1558 2022-04-07               0
## 1559 2022-04-08               0
## 1560 2022-04-09               0
## 1561 2022-04-10               0
## 1562 2022-04-11               0
## 1563 2022-04-12               0
## 1564 2022-04-13               0
## 1565 2022-04-14               0
## 1566 2022-04-15               0
## 1567 2022-04-16               0
## 1568 2022-04-17               0
## 1569 2022-04-18               0
## 1570 2022-04-19               0
## 1571 2022-04-20               0
## 1572 2022-04-21               0
## 1573 2022-04-22               0
## 1574 2022-04-23               0
## 1575 2022-04-24               0
## 1576 2022-04-25               0
## 1577 2022-04-26               0
## 1578 2022-04-27               0
## 1579 2022-04-28               0
## 1580 2022-04-29               0
## 1581 2022-04-30               0
## 1582 2022-05-01               0
## 1583 2022-05-02               0
## 1584 2022-05-03               0
## 1585 2022-05-04               0
## 1586 2022-05-05               0
## 1587 2022-05-06               0
## 1588 2022-05-07               0
## 1589 2022-05-08               1
## 1590 2022-05-09               0
## 1591 2022-05-10               0
## 1592 2022-05-11               0
## 1593 2022-05-12               0
## 1594 2022-05-13               0
## 1595 2022-05-14               0
## 1596 2022-05-15               0
## 1597 2022-05-16               0
## 1598 2022-05-17               0
## 1599 2022-05-18               0
## 1600 2022-05-19               0
## 1601 2022-05-20               0
## 1602 2022-05-21               0
## 1603 2022-05-22               0
## 1604 2022-05-23               0
## 1605 2022-05-24               0
## 1606 2022-05-25               0
## 1607 2022-05-26               0
## 1608 2022-05-27               0
## 1609 2022-05-28               0
## 1610 2022-05-29               0
## 1611 2022-05-30               0
## 1612 2022-05-31               1
## 1613 2022-06-01               0
## 1614 2022-06-02               0
## 1615 2022-06-03               0
## 1616 2022-06-04               0
## 1617 2022-06-05               0
## 1618 2022-06-06               0
## 1619 2022-06-07               0
## 1620 2022-06-08               0
## 1621 2022-06-09               0
## 1622 2022-06-10               0
## 1623 2022-06-11               0
## 1624 2022-06-12               0
## 1625 2022-06-13               0
## 1626 2022-06-14               0
## 1627 2022-06-15               0
## 1628 2022-06-16               0
## 1629 2022-06-17               0

Part 3: Calculate the average of all days for the above-mentioned period from “No. of articles”.

print(paste0("The average number of daily articles between ", as.character(historical_dates[1])
             , " and ", as.character(historical_dates[days]), " is ", as.character(mean(df.daily_article_count$`No. of articles`))))
## [1] "The average number of daily articles between 2018-01-01 and 2022-06-17 is 0.128913443830571"

Part 4: In which section are most articles written?

sqldf('SELECT sectionName, count(*) 
      FROM "df.article_info" 
      WHERE webPublicationDate>="2018-01-01"
      GROUP BY sectionName
      ORDER BY 2 desc')
##           sectionName count(*)
## 1          World news      146
## 2             Opinion       23
## 3             US news       12
## 4         Environment        5
## 5            Politics        5
## 6            Business        4
## 7             UK news        4
## 8             Fashion        2
## 9  Global development        2
## 10               News        2
## 11             Cities        1
## 12            Culture        1
## 13         Membership        1
## 14              Sport        1
## 15         Technology        1
answer_4<- sqldf('SELECT sectionName, count(*) 
      FROM "df.article_info" 
      WHERE webPublicationDate>="2018-01-01"
      GROUP BY sectionName
      ORDER BY 2 desc
      LIMIT 1')

print(paste0("The section with the most number of articles in the period of interest is " ,answer_4[[1]],
             " with ", answer_4[[2]], " total articles."))
## [1] "The section with the most number of articles in the period of interest is World news with 146 total articles."

Part 5: Show the evolution of the “No. of articles” over time for the above period.

##theme_set(theme_classic())
# Plot
g <- ggplot(df.daily_article_count, aes(Date, `No. of articles`))
g + geom_bar(stat="identity", width = 0.5, fill="darkblue") + 
      labs(title="No. of Daily Articles Since 2018-01-01", 
           subtitle="Justin Trudeau", 
           caption="Source: Guardian Media Group API") +
      theme(axis.text.x = element_text(angle=65, vjust=0.6))

The above chart is hard to read since there are so many dates on the x axis. Let’s also look at the data grouped by month:

## first create a new month column for this plot
df.daily_article_count$Year_Month<-paste0(lubridate::year(df.daily_article_count$Date), " " ,month.abb[month(df.daily_article_count$Date)])

## Plot the data
g2 <- ggplot(df.daily_article_count, aes(Year_Month, `No. of articles`))
g2 + geom_bar(stat="sum", width = 0.5, fill="darkblue") + 
      labs(title="No. of Daily Articles Since 2018-01-01", 
           subtitle="Justin Trudeau", 
           caption="Source: Guardian Media Group API") +
  scale_y_continuous(breaks= pretty_breaks(), limits = (c(0,11)))+
      theme(axis.text.x = element_text(angle=65, vjust=0.6), legend.position="none") ## makes x axis readable

Part 6: Are there any unusual events in the time series under investigation?

Yes! In the daily plot (although hard to read), we can see there are specific dates that have higher numbers of articles. In the monthly plot, we can see which months these spikes occur in. Let’s create a heatmap for easier identification of these unusal events.

## first let's create a new dataframe with added date variables we will need
df.daily_article_count_plot<-df.daily_article_count
df.daily_article_count_plot$Date <- as.Date(df.daily_article_count_plot$Date)  # format date

# Create Month Week
df.daily_article_count_plot$year <- year(df.daily_article_count_plot$Date)
df.daily_article_count_plot$month <- month(df.daily_article_count_plot$Date)
df.daily_article_count_plot$monthf <- factor(month(df.daily_article_count_plot$Date))
df.daily_article_count_plot$yearmonth <- as.yearmon(df.daily_article_count_plot$Date)
df.daily_article_count_plot$yearmonthf <- factor(df.daily_article_count_plot$yearmonth)
df.daily_article_count_plot$week<- lubridate::week(ymd(df.daily_article_count_plot$Date))
df.daily_article_count_plot <- ddply(df.daily_article_count_plot,.(yearmonthf), transform, monthweek=1+week-min(week))  # compute week number of month
df.daily_article_count_plot$weekday<-weekdays(as.Date(df.daily_article_count_plot$Date))
df.daily_article_count_plot$weekdayf<-factor(df.daily_article_count_plot$weekday)

# Plot
ggplot(df.daily_article_count_plot, aes(monthweek, weekdayf, fill = No..of.articles)) + 
  geom_tile(colour = "white") + 
  facet_grid(year~monthf) + 
  scale_fill_gradient(low="green", high="red") +
  labs(x="Week of Month",
       y="",
       title="No. of Monthly Articles Since 2018-01-01", 
           subtitle="Justin Trudeau", 
       fill="Daily Articles")

Part 7: If so, show these. Why are these unusual? (Define for yourself what you want to show by ordinary or unusual).

From the Heat Map above we can define “ordinary” by the colors which are most prevelant. We can see that most squares are bright green, meaning the typical behavior is for only 1 or no articles to be published on a given day. Then we can see that on specific days the squares are shades of red, indicating that there are more articles than typical on these days. The darker the square, the more unusual.

There is one day in particular that is the darkest red of all! This day is in June 2018 and has 6 articles on a single day. There are also a few other unusual days where we can see there are 4 or 3 articles a day.

Part 8: Based on question one. Show the cause of the unusual event.

Now that we know when the unusual day was and the number of articles on that day, we can look at the original data pulled in part 1 to find out what could be the cause. Please note, the same logic could be used to look into the other adnormal days (i.e. days with 4 articles).

## check the date with 6 articles
df.daily_article_count[df.daily_article_count$`No. of articles`==6,][1]
##           Date
## 162 2018-06-11
# Pull the Titles of the articles on this day for a good overview of the content
events<-subset(df.article_info,df.article_info$webPublicationDate=='2018-06-11')
print(events$webTitle)
## [1] 'Prepare for the worst': souring Canada-US relations fuel worries of trade war           
## [2] Hanger-on May is no more than a bit player at the G7 summit | John Crace                 
## [3] Canada and America are cousins. We don't stab each other in the back | Margaret MacMillan
## [4] Trump, Merkel, Macron: the G7 photos worth a thousand words | Hannah Jane Parkinson      
## [5] Trudeau 'stabbed us in back' on trade, says Trump chief economic adviser                 
## [6] Trump is a bully who thought Canada was weak. He was wrong about us | Jen Gerson         
## 395 Levels: 'Give her whatever she wants': readers on Sophie Grégoire Trudeau's staffing plea | Guardian readers and Sarah Marsh ...

From the titles, we can already see that the G7 summit had taken place and that there was conflict between Trump and Trudeau (US v Canada) related to trade.

*Should we want to know more specifics about this event (i.e. to find the conflict was regaurding Trudeau declaring he would fight back against the US’s new tarrifs on aluminum and steel), we could pull the full content of these 6 articles from the API and do a text analysis.

Bonus: Let’s say there had been more than 6 articles (i.e. 100+) and we wanted to process all the information easier. We could create a word cloud of the titles to find the main topics. Below is an example:

## first we need to prepare the text for processing
titles<-c()
for (a in 1:length(events$webTitle))
{
  titles_level<-events$webTitle[[a]]
  titles<-cbind(titles,levels(events$webTitle)[titles_level])
}
ctext = Corpus(VectorSource(titles))

## next let's remove potential words and punctuation which are not helpful
ctext = tm_map(ctext,tolower)
ctext = tm_map(ctext,removePunctuation)
ctext = tm_map(ctext,removeWords,stopwords("english"))
inspect(ctext)
## <<SimpleCorpus>>
## Metadata:  corpus specific: 1, document level (indexed): 0
## Content:  documents: 6
## 
## [1] prepare   worst souring canadaus relations fuel worries  trade war         
## [2] hangeron may      bit player   g7 summit  john crace                       
## [3] canada  america  cousins  dont stab     back  margaret macmillan           
## [4] trump merkel macron  g7 photos worth  thousand words  hannah jane parkinson
## [5] trudeau stabbed us  back  trade says trump chief economic adviser          
## [6] trump   bully  thought canada  weak   wrong  us  jen gerson
tdm = TermDocumentMatrix(ctext,control=list(minWordLength=1))
tdm2 = as.matrix(tdm)
wordcount = sort(rowSums(tdm2),decreasing=TRUE)
tdm_names = names(wordcount)
wordcloud(tdm_names,wordcount,min.freq = 2)

Using the wordcloud we can already see the unusual event was related to Trump and trade! However, G7 does not apear because it is not a “real word”, which is a downside of this method.