Closed hamishgibbs closed 3 years ago
So the idea here is to take two sets of Rt estimates (say global estimates and UN region estimates) then glue them together in the format that RtD3
understands (whilst also filtering for a chosen country). That lets you have say the national estimate as the default for a set of subnational estimates... (https://epiforecasts.io/covid/posts/national/united-kingdom/).
Perhaps a better way to do this would be.
national_esitmates <- RtD3::read....
subnational_estimates <- RtD3::read...
estimates <- RtD3::join_data(national_esimates, subnational_estimates)
RtD3::summaryWidget......
So literally just do the somewhat complicated and dull join for people (though this throws away the handy filter on country functionality I would need (but can put in elsewhere)). This code basically,
join_RtD3_data <- function(rtData, rtData2) {
# Join the subregional and national estimates together.
rtData <- purrr::map2(rtData, rtData2,
~ data.table::rbindlist(list(
.x[, lapply(.SD, as.character)],
.y[, lapply(.SD, as.character)]),
use.names = TRUE, fill = TRUE))
return(rtData)
}
Potentially the region filter could be added to RtD3::readInEpiNow2
? Can imagine it being handy potentially.
Potentially the answer is that this function is not really needed in RtD3
. Your call @hamishgibbs
What is the purpose of the country filter?
Sounds good to me to have RtD3::join_data
added as it is nice to have the widgets initiate with national estimates
Confuse the mind and dazzle the senses....
To let you join the UK national estimate into the UK subnational estimates (used here: https://github.com/epiforecasts/covid/blob/master/utils/subnational_defaults.R) which I can see being a thing others may want to do (or just show a subset of some estimates loaded in from EpiNow2).
though to fit the naming scheme probably needs to be called joinrtData
or some such?
joinRtData
? although rtData <- joinRtData
gives me camelcase anxiety
I support putting this in. Sounds good - would you like to do it?
yes, will do over the weekend. Hence why snake case is the best case.
Thanks!
🐫
done in #32
Incorporating
join_RtD3_data
inRtD3
, notcovid
.https://github.com/epiforecasts/covid/blob/master/utils/join_RtD3_data.R
I can see that this function is about ensuring required column names (region -> Region) and joining the national estimates to subnational estimates?
Is that for display in the subnational pages?
14 should address the region -> Region change.
Then with this added to
RtD3
, will it be general for people who do not have a web framework - or have their own url patterns?@seabbs