-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
With daily-time daily-version data and multiple locations, the wait time can be an annoyance, or it can brick some machines (maybe from memory usage expanding quadratically). Here's some progress toward a faster approach, at least if there aren't a bunch of revisions:
tibble(
current = s05_smoothed_phrru_archive$DT %>%
as.data.frame() %>%
as_tibble(),
preceding =
s05_smoothed_phrru_archive$DT[
unique(s05_smoothed_phrru_archive$DT[, key_colnames(s05_smoothed_phrru_archive), with = FALSE])[
, time_value := epiprocess:::time_minus_n_steps(time_value, 1L, s05_smoothed_phrru_archive$time_type)
],
on = key_colnames(s05_smoothed_phrru_archive),
roll = TRUE
] %>%
as.data.frame() %>%
as_tibble(),
subsequent =
copy(s05_smoothed_phrru_archive$DT)[
, .version := version
][
unique(s05_smoothed_phrru_archive$DT[, key_colnames(s05_smoothed_phrru_archive), with = FALSE])[
, time_value := epiprocess:::time_plus_n_steps(time_value, 1L, s05_smoothed_phrru_archive$time_type)
],
on = key_colnames(s05_smoothed_phrru_archive),
roll = TRUE
] %>%
as.data.frame() %>%
as_tibble()
) %>%
filter(current$geo_value == "103") %>%
mutate(current_lag = current$version - current$time_value) %>%
# ggplot(aes(colour = current$version)) %>%
ggplot(aes(colour = current_lag)) %>%
`+`(geom_segment(aes(x = preceding$time_value, xend = current$time_value,
y = preceding$s05_smoothed, yend = current$s05_smoothed),
function(tbl) {
tbl %>% filter(!is.na(preceding$s05_smoothed))
})) %>%
`+`(geom_segment(aes(x = current$time_value, xend = subsequent$time_value,
y = current$s05_smoothed, yend = subsequent$s05_smoothed),
function(tbl) {
tbl %>% filter(!is.na(subsequent$s05_smoothed), current$version != subsequent$.version)
})) %>%
# `+`(scale_colour_viridis_c(trans = "date")) %>%
`+`(scale_colour_viridis_c()) %>%
{}
todo: faceting, isolated points
Metadata
Metadata
Assignees
Labels
No labels