I have a current graph that I am trying to produce where I am calculating the total number of deaths in a given data set. I have used the filter function to begin the count after 50 deaths have occurred for that plot. However rather than show the months at the bottom of the plot, I would like it to show days since the 50th death? As-well, how can I allow this plot to start at the origin. Attached I have included my current plot and code I am working with.
#these libraries are necessary
library(readxl)
library(httr)
library(tidyverse)
#create the URL where the dataset is stored with automatic updates every day
url <- paste("https://www.ecdc.europa.eu/sites/default/files/documents/COVID-19-geographic-disbtribution-worldwide-",format(Sys.time(), "%Y-%m-%d"), ".xlsx", sep = "")
#download the dataset from the website to a local temporary file
GET(url, authenticate(":", ":", type="ntlm"), write_disk(tf <- tempfile(fileext = ".xlsx")))
#read the Dataset sheet into “R”
data <- read_excel(tf)
data %>%
filter(countriesAndTerritories %in% c("Spain", "Australia", "United_Kingdom", "Japan", "Germany", "Belgium", "Italy", "South_Korea", "China", "Canada", "United_States_of_America")) %>%
arrange(countriesAndTerritories, dateRep) %>%
group_by(countriesAndTerritories) %>%
mutate(cum_deaths = cumsum(deaths)) %>%
filter(cum_deaths >= 50) %>%
ggplot(aes(dateRep, deaths, colour = countriesAndTerritories)) +
#geom_point() +
scale_y_log10() +
geom_smooth()