Modify the .R scripts in the testthat
folder to automatically check your data for errors. GitHub Actions will automatically run any R script files inside the testthat
folder. For example, copy this script into testthat/test-periods-ga.R
. It will automatically make sure that the sampling period values in your data are plausible.
library(testthat)
library(dplyr)
library(readr)
context("Checks that all values in period variable are valid.")
base_data <- read_csv("../data-raw/data.csv")
test_that(
desc = "Period values are valid.",
code = {
all_period_values_valid <- all(base_data$period < 1000)
expect_true(all_period_values_valid)
}
)