Skip to content

Commit 59f958d

Browse files
committed
ok, we format floating point numbers to strings for comparison
because signif alone didn't work well on Linux platforms
1 parent dc1d776 commit 59f958d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tests/testthat/helpers.R

+2-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ load_test_pbp <- function(pbp = pbp_cache, dir = test_dir){
1515

1616
# model output differs across machines so we round to 4 significant digits
1717
# to prevent failing tests
18-
pbp_data <- build_nflfastR_pbp(game_ids, dir = dir, games = g) %>%
19-
# we gotta round floating point numbers because of different model output
20-
# across platforms
21-
round_double_to_digits()
18+
pbp_data <- build_nflfastR_pbp(game_ids, dir = dir, games = g)
2219
if(!is.null(dir)) saveRDS(pbp_data, pbp)
2320
pbp_data
2421
}
@@ -58,5 +55,5 @@ strip_nflverse_attributes <- function(df){
5855
}
5956

6057
round_double_to_digits <- function(df, digits = 4){
61-
dplyr::mutate_if(df, is.double, signif, digits = digits)
58+
dplyr::mutate_if(df, is.double, formatC, digits = digits, format = "fg")
6259
}

0 commit comments

Comments
 (0)