Get Timeseries from EpiNow

get_timeseries(results_dir = NULL, date = NULL, summarised = FALSE)

Arguments

results_dir

A character string indicating the folder containing the EpiNow results to extract.

date

A Character string (in the format "yyyy-mm-dd") indicating the date to extract data for. Defaults to "latest" which finds the latest results available.

summarised

Logical, defaults to FALSE. Should full or summarised results be returned.

Value

A list of reproduction number estimates and nowcast cases

Examples

if (FALSE) { ## Assuming epiforecasts/covid is one repo higher ## Summary results get_timeseries("../covid/_posts/global/nowcast/results/", summarised = TRUE) ## Simulations get_timeseries("../covid/_posts/global/nowcast/results/") } ## Code get_timeseries
#> function (results_dir = NULL, date = NULL, summarised = FALSE) #> { #> if (is.null(date)) { #> date <- "latest" #> } #> if (summarised) { #> nowcast <- "summarised_nowcast.rds" #> rt_index <- 1 #> } #> else { #> nowcast <- "nowcast.rds" #> rt_index <- 3 #> } #> regions <- list.files(results_dir) #> names(regions) <- regions #> load_data <- purrr::safely(EpiNow::load_nowcast_result) #> rt <- purrr::map_dfr(regions, ~load_data("time_varying_params.rds", #> ., result_dir = results_dir, date = date)[[1]][[rt_index]], #> .id = "region") #> incidence <- purrr::map_dfr(regions, ~load_data(nowcast, #> ., result_dir = results_dir, date = date)[[1]], .id = "region") #> out <- list(rt, incidence) #> names(out) <- c("rt", "incidence") #> return(out) #> } #> <bytecode: 0x7fdc07307d90> #> <environment: namespace:EpiNow>