summarize_over_time | R Documentation |
All apps should use this functions to do aggregations!
summarize_over_time(data_filtered)
Aggregation over period: If data is missing during more than 25% of the most recent observations, the period is considered incomplete, no aggregated value is computed.
Aggregation over group: Groups aggregations use all the countries for which data is available. If a ratio is computed (e.g., per-captia measures, positivity rate), we only consider observations that have values both for the nominator and the denominator. E.g., in order to calculate tests per-capita for a continent, a country is only used if reports both test and population data.
This is a deviation from an older discussion in: https://github.com/dsbbfinddx/shinyfindapps/issues/142#issuecomment-1023435405
See discussiofn in: https://github.com/finddx/shinyfindapps/issues/142#issuecomment-1023435405
library(shinyfind)
library(dplyr)
. <- get_data_all()
data_all <- .$data_all
country_last_update_info <- .$country_last_update_info
time_start <- as.Date(max(data_all$time) - 367)
time_end <- as.Date(max(data_all$time) - 2)
data_filtered <-
data_all |>
filter(set == "country") |>
select(-name, -set) |>
left_join(country_last_update_info, by = "unit") |>
filter(!is.na(last_update))|>
filter(dplyr::between(
time,
as.Date(time_start),
as.Date(time_end)
))
data_summarized_over_time <- shinyfind::summarize_over_time(data_filtered)
shinyfind::summarize_over_group(data_summarized_over_time, "income")
shinyfind::summarize_over_group(data_summarized_over_time, "who_region")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.