@@ -790,6 +790,8 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
790790# ' as.Date("2020-06-15"),
791791# ' by = "1 day")
792792# '
793+ # ' # A simple (but not very useful) example (see the archive vignette for a more
794+ # ' # realistic one):
793795# ' archive_cases_dv_subset %>%
794796# ' group_by(geo_value) %>%
795797# ' epix_slide(f = ~ mean(.x$case_rate_7d_av),
@@ -801,10 +803,14 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
801803# ' # values. The actual number of `time_value`s in each computation depends on
802804# ' # the reporting latency of the signal and `time_value` range covered by the
803805# ' # archive (2020-06-01 -- 2021-11-30 in this example). In this case, we have
804- # ' # 0 `time_value`s, for ref time 2020-06-01 --> the result is automatically discarded
805- # ' # 1 `time_value`, for ref time 2020-06-02
806- # ' # 2 `time_value`s, for the rest of the results
807- # ' # never 3 `time_value`s, due to data latency
806+ # ' # * 0 `time_value`s, for ref time 2020-06-01 --> the result is automatically
807+ # ' # discarded
808+ # ' # * 1 `time_value`, for ref time 2020-06-02
809+ # ' # * 2 `time_value`s, for the rest of the results
810+ # ' # * never the 3 `time_value`s we would get from `epi_slide`, since, because
811+ # ' # of data latency, we'll never have an observation
812+ # ' # `time_value == ref_time_value` as of `ref_time_value`.
813+ # ' # The example below shows this type of behavior in more detail.
808814# '
809815# ' # Examining characteristics of the data passed to each computation with
810816# ' # `all_versions=FALSE`.
@@ -841,8 +847,12 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
841847# ' epix_slide(
842848# ' function(x, g) {
843849# ' tibble(
844- # ' versions_start = min(x$DT$version),
845- # ' versions_end = max(x$versions_end),
850+ # ' versions_start = if (nrow(x$DT) == 0L) {
851+ # ' "NA (0 rows)"
852+ # ' } else {
853+ # ' toString(min(x$DT$version))
854+ # ' },
855+ # ' versions_end = x$versions_end,
846856# ' time_range = if(nrow(x$DT) == 0L) {
847857# ' "0 `time_value`s"
848858# ' } else {
@@ -855,7 +865,9 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
855865# ' before = 5, all_versions = TRUE,
856866# ' ref_time_values = ref_time_values, names_sep=NULL) %>%
857867# ' ungroup() %>%
858- # ' arrange(geo_value, time_value)
868+ # ' # Focus on one geo_value so we can better see the columns above:
869+ # ' filter(geo_value == "ca") %>%
870+ # ' select(-geo_value)
859871# '
860872# ' @importFrom rlang enquo !!!
861873# ' @export
0 commit comments