Skip to content

Commit 889d53e

Browse files
committed
fixing check and linter
1 parent cd7787d commit 889d53e

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

R/revision_analysis.R

+6-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#' actually change very much. Default is .1, or 10% of the final value
5757
#' @param compactify_tol float, used if `drop_nas=TRUE`, it determines the
5858
#' threshold for when two floats are considered identical.
59+
#' @param should_compactify bool. Compactify if `TRUE`.
5960
#' @examples
6061
#'
6162
#' revision_example <- revision_summary(archive_cases_dv_subset, percent_cli)
@@ -74,8 +75,8 @@ revision_summary <- function(epi_arch,
7475
within_latest = 0.2,
7576
quick_revision = as.difftime(3, units = "days"),
7677
few_revisions = 3,
77-
rel_spread_threshold = 0.1,
7878
abs_spread_threshold = NULL,
79+
rel_spread_threshold = 0.1,
7980
compactify_tol = .Machine$double.eps^0.5,
8081
should_compactify = TRUE) {
8182
arg <- names(eval_select(rlang::expr(c(...)), allow_rename = FALSE, data = epi_arch$DT))
@@ -144,7 +145,10 @@ revision_summary <- function(epi_arch,
144145
time_near_latest = as.difftime(time_to, units = "days") # nolint: object_usage_linter
145146
) %>%
146147
select(-time_to) %>%
147-
relocate(time_value, geo_value, all_of(keys), n_revisions, min_lag, max_lag, time_near_latest, spread, rel_spread, min_value, max_value, median_value)
148+
relocate(
149+
time_value, geo_value, all_of(keys), n_revisions, min_lag, max_lag, # nolint: object_usage_linter
150+
time_near_latest, spread, rel_spread, min_value, max_value, median_value # nolint: object_usage_linter
151+
)
148152
if (print_inform) {
149153
cli_inform("Min lag (time to first version):")
150154
difftime_summary(revision_behavior$min_lag) %>% print()

man/revision_summary.Rd

+7-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/archive.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# new_epi_archive correctly detects and warns about compactification
2+
3+
Code
4+
res <- dumb_ex %>% as_epi_archive()
5+
Condition
6+
Warning:
7+
Found rows that appear redundant based on last (version of each) observation carried forward; these rows have been removed to 'compactify' and save space:
8+
Key: <geo_value, time_value, version>
9+
geo_value time_value value version
10+
<char> <Date> <num> <Date>
11+
1: ca 2020-01-01 1 2020-01-02
12+
Built-in `epi_archive` functionality should be unaffected, but results may change if you work directly with its fields (such as `DT`). See `?as_epi_archive` for details. To silence this warning but keep compactification, you can pass `compactify=TRUE` when constructing the archive.
13+

0 commit comments

Comments
 (0)