@@ -790,6 +790,8 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
790
790
# ' as.Date("2020-06-15"),
791
791
# ' by = "1 day")
792
792
# '
793
+ # ' # A simple (but not very useful) example (see the archive vignette for a more
794
+ # ' # realistic one):
793
795
# ' archive_cases_dv_subset %>%
794
796
# ' group_by(geo_value) %>%
795
797
# ' 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
801
803
# ' # values. The actual number of `time_value`s in each computation depends on
802
804
# ' # the reporting latency of the signal and `time_value` range covered by the
803
805
# ' # 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.
808
814
# '
809
815
# ' # Examining characteristics of the data passed to each computation with
810
816
# ' # `all_versions=FALSE`.
@@ -841,8 +847,12 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
841
847
# ' epix_slide(
842
848
# ' function(x, g) {
843
849
# ' 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,
846
856
# ' time_range = if(nrow(x$DT) == 0L) {
847
857
# ' "0 `time_value`s"
848
858
# ' } else {
@@ -855,7 +865,9 @@ group_by.epi_archive = function(.data, ..., .add=FALSE, .drop=dplyr::group_by_dr
855
865
# ' before = 5, all_versions = TRUE,
856
866
# ' ref_time_values = ref_time_values, names_sep=NULL) %>%
857
867
# ' 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)
859
871
# '
860
872
# ' @importFrom rlang enquo !!!
861
873
# ' @export
0 commit comments