Skip to content

Commit 6872e02

Browse files
committed
pass local checks
1 parent 788734c commit 6872e02

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

R/revision_analysis.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#' the typical time during which most significant revisions occur. The default
4141
#' of 60 days corresponds to a typical near-final value for case counts as
4242
#' reported in the context of insurance. To avoid this filtering, either set
43-
#' to `NULL` or 0. This will be rounded up to the appropriate `time_type` if
43+
#' to `NULL` or 0. A `difftime` will be rounded up to the appropriate `time_type` if
4444
#' necessary (that is 5 days will be rounded to 1 week if the data is weekly).
4545
#' @param within_latest double between 0 and 1. Determines the threshold
4646
#' used for the `lag_to`
@@ -88,8 +88,10 @@ revision_analysis <- function(epi_arch,
8888
compactify_abs_tol = 0,
8989
return_only_tibble = FALSE) {
9090
assert_class(epi_arch, "epi_archive")
91-
min_waiting_period <- min_waiting_period %>%
92-
difftime_approx_ceiling_time_delta(epi_arch$time_type)
91+
if (methods::is(min_waiting_period, "difftime")) {
92+
min_waiting_period <- min_waiting_period %>%
93+
difftime_approx_ceiling_time_delta(epi_arch$time_type)
94+
}
9395
# if the column to summarize isn't specified, use the only one if there is only one
9496
if (dots_n(...) == 0) {
9597
# Choose the first column that's not a key:
@@ -225,8 +227,10 @@ print.revision_analysis <- function(x,
225227
abs_spread_threshold = NULL,
226228
rel_spread_threshold = 0.1,
227229
...) {
228-
quick_revision <- quick_revision %>%
229-
difftime_approx_ceiling_time_delta(x$time_type)
230+
if (methods::is(quick_revision, "difftime")) {
231+
quick_revision <- quick_revision %>%
232+
difftime_approx_ceiling_time_delta(x$time_type)
233+
}
230234
if (is.null(abs_spread_threshold)) abs_spread_threshold <- .05 * x$max_val
231235
rev_beh <- x$revision_behavior
232236
cli::cli_h2("An epi_archive spanning {.val {x$range_time_values[1]}} to {.val {x$range_time_values[1]}}.")

0 commit comments

Comments
 (0)