R Under development (unstable) (2024-01-07 r85787 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(testthat) > library(RTL) > > #test_check("RTL") > > test_that("tradeCycle Canadian",{ + x = tradeCycle %>% dplyr::mutate(diff = as.numeric(trade.cycle.end-.[[2]])) + expect_lt(x %>% dplyr::filter(market == "canada") %>% dplyr::select(diff) %>% min(.),-10) + expect_gt(x %>% dplyr::filter(market == "canada") %>% dplyr::select(diff) %>% min(.),-21) + }) Test passed 🥳 > > test_that("tradeCycle US Domestic",{ + x = tradeCycle %>% dplyr::mutate(diff = as.numeric(trade.cycle.end-.[[2]])) + expect_lt(x %>% dplyr::filter(market == "usdomestic") %>% dplyr::select(diff) %>% min(.),-5) + expect_gt(x %>% dplyr::filter(market == "usdomestic") %>% dplyr::select(diff) %>% min(.),-15) + }) Test passed 🥇 > > # > # dataGaps = dfwide %>% > # tidyr::pivot_longer(-date,"series","value")%>% dplyr::group_by(series) %>% > # dplyr::mutate(diff = dplyr::lag(date), > # diff = date - diff) %>% > # tidyr::drop_na() %>% > # dplyr::summarise(missingDays = max(diff)) %>% > # dplyr::filter(missingDays > 5) > # > # ss <- dataGaps$series[24] > # > # dfwide %>% > # dplyr::select(date,ss) %>% > # filter_all(any_vars(is.na(.))) > # dplyr::filter(!is.na(ss)) > # > # dataGaps <- dfwide %>% > # dplyr::select(date,BRN01) %>% > # dplyr::mutate(dd = as.numeric(date), > # diff = dplyr::lag(dd), > # diff2 = diff - dd) > # > > proc.time() user system elapsed 1.46 0.31 1.78