Commit 0954e458 authored by Renaud Lancelot's avatar Renaud Lancelot 🌍
Browse files

Resolved conflicts with Facundo's updates. Had to remove two items from the...

Resolved conflicts with Facundo's updates. Had to remove two items from the plan and include them in thz template because the plan could not generate them.
parent 51f048ba
Pipeline #14113 passed with stage
......@@ -42,6 +42,7 @@ pdf.options(family = "Palatino")
```
```{r load-targets}
loadd(
......@@ -54,13 +55,21 @@ loadd(
eust,
pop_countries_2019,
covid,
lockdown_dates,
deaths_by_ctry_dt, # deaths by country and date
data_update_date, # date of update of covid data
lockdown_dates
)
deaths_by_ctry_dt <- covid %>%
group_by(date, name) %>%
summarise(deaths = sum(deaths)) %>%
ungroup() %>%
mutate(date = as.Date(date))
data_update_date <- format(Sys.Date() - 1,
"%d %b %Y")
```
```{r european-countries}
## European countries
european_countries <- sort(c(eu28, efta, candi, noneu)) %>%
......@@ -77,6 +86,7 @@ covid$name <- standardise_country_names(covid$name)
```
```{r country-data}
## Variables relative to European countries:
......@@ -633,23 +643,22 @@ dmrplot(dmr = Dfr,
## Time trends in daily mortality growth rate{-}
```{r growthRate}
<<<<<<< HEAD
z1 <- subset(covid,
select = c("date", "name", "deaths"))
## aggregate deaths by country and date
z2 <- aggregate(deaths ~ date + name, data = z, FUN = sum)
z2$date <- as.Date(as.character(z2$date))
## merge covid data with pop size, and lockdonw date
z3 <- merge(merge(pop_countries_2019, z2, by = "name"),
conf,
by = "name")
=======
>>>>>>> 7c10514c2ef3615d8f3eacbf3d37f6850cc13b07
## define a new variable "day" with day=0 at the frist death
## <<<<<<< HEAD
## z1 <- subset(covid,
## select = c("date", "name", "deaths"))
## ## aggregate deaths by country and date
## z2 <- aggregate(deaths ~ date + name, data = z, FUN = sum)
## z2$date <- as.Date(as.character(z2$date))
## ## merge covid data with pop size, and lockdonw date
## z3 <- merge(merge(pop_countries_2019, z2, by = "name"),
## conf,
## by = "name")
## =======
## >>>>>>> 7c10514c2ef3615d8f3eacbf3d37f6850cc13b07
## define a new variable "day" with day=0 at the first death
z4 <- do.call(
"rbind",
by(Dfr,
......
......@@ -8,18 +8,43 @@ library(drake)
# The workflow plan data frame outlines what you are going to do.
plan <- drake_plan(
## raw_data = read_excel(
## file_in(here("data/..."))
## ),
## clean_data = raw_data %>% cleanup(),
# SOURCE DATA -------------------------------------------------------------
## Total population counts and densities by Country, Year and Sex.
## Source: United Nations'[World Population Prospects
## 2019](https://population.un.org/wpp/)
## https://population.un.org/wpp/Download/Standard/CSV/
world_population = read.table(
## raw_data = read_excel(
## file_in(here("data/..."))
## ),
## clean_data = raw_data %>% cleanup(),
## SOURCE DATA -------------------------------------------------------------
## Europe and neighbour countries
## EUrope 27 + UK
eu28 = c("Austria", "Belgium", "Bulgaria", "Croatia",
"Cyprus", "Czech Republic", "Denmark", "Estonia",
"Finland", "France", "Germany", "Greece", "Hungary",
"Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg",
"Malta", "Netherlands", "Poland", "Portugal",
"Romania", "Slovakia", "Slovenia", "Spain", "Sweden",
"United Kingdom"),
## European free trade association
efta = c("Iceland", "Liechtenstein", "Norway", "Switzerland"),
## Candidate countries
candi = c("Albania", "Montenegro", "North Macedonia",
"Serbia", "Turkey"),
## Other countries
noneu = c("Bosnia and Herzegovina", "Kosovo"),
## neighbour countries
enp = c("Algeria", "Armenia", "Azerbaijan", "Belarus", "Egypt",
"Georgia", "Israel", "Jordan", "Lebanon", "Libya",
"Moldova", "Morocco", "Syria", "Tunisia", "Ukraine"),
## Total population counts and densities by Country, Year and Sex.
## Source: United Nations'[World Population Prospects
## 2019](https://population.un.org/wpp/)
## https://population.un.org/wpp/Download/Standard/CSV/
world_population = read.table(
file_in("https://population.un.org/wpp/Download/Files/1_Indicators%20(Standard)/CSV_FILES/WPP2019_TotalPopulationBySex.csv"),
header = T,
sep = ",",
......@@ -31,12 +56,14 @@ plan <- drake_plan(
## ECDC Covid19 geographic distribution data
last_day = Sys.Date() - 1,
## string for today
sdt = format(Sys.Date(), "%d %b %Y"),
sdt = format(Sys.Date(),
"%d %b %Y"),
covid = ecdc_covid19(last_day),
covid = ecdc_covid19(Sys.Date() - 1),
## String notice for data update
data_update_date = format(last_day, "%d %b %Y"),
## ## String notice for data update
## data_update_date = format(Sys.Date() - 1,
## "%d %b %Y"),
## Lock-down dates
lockdown_dates = read_excel(file_in("data/lockdown.xlsx")) %>%
......@@ -56,54 +83,30 @@ plan <- drake_plan(
roi_europe_light = readOGR(dsn = "data/roi_europe_light.gpkg",
layer = "roi_europe_light"),
geo_europe = readOGR(dsn = file_in("data/geo_europe.gpkg"),
layer = "geo_europe"),
## geo_europe = readOGR(dsn = file_in("data/geo_europe.gpkg"),
## layer = "geo_europe"),
## GIS vector layer for the region of interest covering European
## countries described above
roi_europe = readOGR(dsn = file_in("data/roi_europe.gpkg"),
layer = "roi_europe"),
## Europe and neighbour countries
## EUrope 27 + UK
eu28 = c("Austria", "Belgium", "Bulgaria", "Croatia",
"Cyprus", "Czech Republic", "Denmark", "Estonia",
"Finland", "France", "Germany", "Greece", "Hungary",
"Ireland", "Italy", "Latvia", "Lithuania", "Luxembourg",
"Malta", "Netherlands", "Poland", "Portugal",
"Romania", "Slovakia", "Slovenia", "Spain", "Sweden",
"United Kingdom"),
## European free trade association
efta = c("Iceland", "Liechtenstein", "Norway", "Switzerland"),
## Candidate countries
candi = c("Albania", "Montenegro", "North Macedonia",
"Serbia", "Turkey"),
## Other countries
noneu = c("Bosnia and Herzegovina", "Kosovo"),
## neighbour countries
enp = c("Algeria", "Armenia", "Azerbaijan", "Belarus", "Egypt",
"Georgia", "Israel", "Jordan", "Lebanon", "Libya",
"Moldova", "Morocco", "Syria", "Tunisia", "Ukraine"),
# DERIVED DATA ------------------------------------------------------------
## Deaths by country and date
deaths_by_ctry_dt =
covid %>%
group_by(date, name) %>%
summarise(deaths = sum(deaths)) %>%
ungroup() %>%
mutate(date = as.Date(date)),
## roi_europe = readOGR(dsn = file_in("data/roi_europe.gpkg"),
## layer = "roi_europe"),
## DERIVED DATA ----------------------------------------
## ## Deaths by country and date
## deaths_by_ctry_dt =
## covid %>%
## group_by(date, name) %>%
## summarise(deaths = sum(deaths)) %>%
## ungroup() %>%
## mutate(date = as.Date(date)),
## Population counts in thousands of people
pop_countries_2019 = pop_countries(world_population, year = 2019),
## today (ANSI)
tod = format(Sys.Date(), "%Y%m%d"),
## ## today (ANSI)
## tod = format(Sys.Date(), "%Y%m%d"),
## Coordinate Reference Systems
wgs84 = CRS("+proj=longlat +ellps=WGS84",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment