From 59f958d559500d397e30f599f1a4df44424e8d1b Mon Sep 17 00:00:00 2001 From: mrcaseb Date: Thu, 22 Dec 2022 14:38:24 +0100 Subject: [PATCH] ok, we format floating point numbers to strings for comparison because signif alone didn't work well on Linux platforms --- tests/testthat/helpers.R | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/testthat/helpers.R b/tests/testthat/helpers.R index 7b9acaed..1334c209 100644 --- a/tests/testthat/helpers.R +++ b/tests/testthat/helpers.R @@ -15,10 +15,7 @@ load_test_pbp <- function(pbp = pbp_cache, dir = test_dir){ # model output differs across machines so we round to 4 significant digits # to prevent failing tests - pbp_data <- build_nflfastR_pbp(game_ids, dir = dir, games = g) %>% - # we gotta round floating point numbers because of different model output - # across platforms - round_double_to_digits() + pbp_data <- build_nflfastR_pbp(game_ids, dir = dir, games = g) if(!is.null(dir)) saveRDS(pbp_data, pbp) pbp_data } @@ -58,5 +55,5 @@ strip_nflverse_attributes <- function(df){ } round_double_to_digits <- function(df, digits = 4){ - dplyr::mutate_if(df, is.double, signif, digits = digits) + dplyr::mutate_if(df, is.double, formatC, digits = digits, format = "fg") }