Skip to content

Commit 51b31c3

Browse files
committed
collapse results if all.equal finds a mismatch
1 parent a078e7f commit 51b31c3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/one_offs/r6_refactor.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ tib <- tibble::tibble(
4242
old_forecasts = old_forecasts,
4343
new_forecasts = new_forecasts,
4444
compare = purrr::map2_chr(old_forecasts, new_forecasts, function(x, y) {
45-
all.equal(qs::qread(x), qs::qread(y)) %>% as.character()
45+
# If objects are not the same, `all.equal` returns a character vector that
46+
# can have `length` > 1. In that case, we need to collapse the output
47+
# into a length-1 string so that `purrr::map2_chr` accepts it.
48+
all.equal(qs::qread(x), qs::qread(y)) %>% as.character() %>% paste(collapse = "; ")
4649
})
4750
)
4851
tib %>%

0 commit comments

Comments
 (0)