Skip to content

Commit

Permalink
Merge pull request #142 from RobLBaker/main
Browse files Browse the repository at this point in the history
bugfix for test_missing_data
  • Loading branch information
RobLBaker authored Jul 29, 2024
2 parents f2fc147 + c11de6e commit b96b6d5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

2024-07-29
* Update license to CC0
* Bug fix from `test_missing_data()`

2024-06-24
* Fixed bug in `test_missing_data()` where if the order of files listed in metadata did not match the order of files produced by `list.files()` the function would evaluate the wrong file and produce inadvertent and unhelpful errors.
Expand Down
11 changes: 6 additions & 5 deletions R/tabular_data_congruence.R
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,11 @@ test_missing_data <- function(directory = here::here(),
missing_types <- c("NA", "blank", "empty")
for (i in seq_along(data_files)) {
#load each file
dat <- suppressMessages(readr::read_csv(paste0(directory,
"/",
data_files[i]),
show_col_types = FALSE))
dat <- suppressWarnings(suppressMessages
(readr::read_csv(paste0(directory,
"/",
data_files[i]),
show_col_types = FALSE)))
#look in each column in the given file
for (j in seq_len(ncol(dat))) {
#look for NAs; if NAs found, look for correct missing data codes
Expand Down Expand Up @@ -682,7 +683,7 @@ test_missing_data <- function(directory = here::here(),
}
if(is.null(error_log)){
cli::cli_inform(c(
"v" = "Missing data listed as NA is accounted for in metadata"))
"v" = 'Missing data listed as NA, "blank", or "empty" is accounted for in metadata'))
}
else{
# really only need to say it once per file/column combo
Expand Down
2 changes: 1 addition & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pkgdown: 2.0.9
pkgdown_sha: ~
articles:
DPchecker: DPchecker.html
last_built: 2024-07-29T16:26Z
last_built: 2024-07-29T23:31Z

2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/testthat/test-tabular_data_congruence.R
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ test_that("test_missing_data displays file-level error message", {
test_that("test_mising_data displays test pass message at column levels", {
expect_message(test_missing_data(here::here(good_dir, "BUIS_good"),
detail_level = "columns"),
"Missing data listed as NA is accounted for in metadata")
'Missing data listed as NA, "blank", or "empty" is accounted for in metadata')
})


Expand Down

0 comments on commit b96b6d5

Please sign in to comment.