Commit 29678d19 authored by Facundo Muñoz's avatar Facundo Muñoz ®️
Browse files

Simplify an innecessary intermediate object and fix notes about population units.

parent 81ccb62f
Pipeline #16561 passed with stage
in 4 minutes and 4 seconds
......@@ -124,19 +124,6 @@ Lock <- do.call(
# pull(n) %>%
# identical(rep(1L, length(.)))
deaths_by_ctry_dt <- covid %>%
group_by(date, name) %>%
summarise(deaths = sum(deaths), .groups = "drop") %>%
mutate(date = as.Date(date))
# identical(
# deaths_by_ctry_dt,
# covid %>%
# select(date, name, deaths) %>%
# mutate(date = as.Date(date)) %>%
# arrange(date, name)
# )
data_update_date <- format(Sys.Date() - 1,
"%d %b %Y")
......@@ -151,7 +138,7 @@ country_data <-
## filter(name != "Liechtenstein") %>%
mutate_if(is.character, as.factor) %>%
left_join(
deaths_by_ctry_dt %>%
covid %>%
group_by(name) %>%
summarise(
cum_deaths = sum(deaths),
......@@ -161,7 +148,6 @@ country_data <-
) %>%
mutate(
## Cumulated number of deaths per 100 K hab.
## Note that pop is expressed in thousands.
death_rate = 1e5 * (cum_deaths / pop)
) %>%
## Arrange rows by descending order of death rate
......@@ -169,7 +155,11 @@ country_data <-
## Deaths by country and date of European countries
## with population and lockdown date added
Dfr <- deaths_by_ctry_dt %>%
Dfr <-
covid %>%
select(date, name, deaths) %>%
mutate(date = as.Date(date)) %>%
arrange(date, name) %>%
inner_join(
country_data,
by = "name"
......@@ -199,7 +189,7 @@ ttnd <- sum(Dfr$deaths)
## character string for overall number of deaths
sttnd <- format(ttnd, big.mark = ",")
## overall population size (in thousands)
## overall population size
ttpop <- sum(country_data$pop)
## character string for overall pop size
......
Markdown is supported
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