From e78b34d8cf3eb4bf53d9ef47c990ee901f3dbaf6 Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 4 Mar 2024 14:34:55 +1100 Subject: [PATCH 1/6] adjust references to pkg names in docs of MCAR test --- R/mcar-test.R | 4 ++-- man/mcar_test.Rd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/mcar-test.R b/R/mcar-test.R index 8a271799..9bb2ae5b 100644 --- a/R/mcar-test.R +++ b/R/mcar-test.R @@ -20,10 +20,10 @@ #' *Journal of the American Statistical Association* 83 (404): #' 1198--1202. \doi{10.1080/01621459.1988.10478722}. #' -#' @note Code is adapted from LittleMCAR() in the now-orphaned {BaylorEdPsych} +#' @note Code is adapted from LittleMCAR() in the now-orphaned `BaylorEdPsych` #' package: \url{https://rdrr.io/cran/BaylorEdPsych/man/LittleMCAR.html}. Some of #' code is adapted from Eric Stemmler: \url{https://web.archive.org/web/20201120030409/https://stats-bayes.com/post/2020/08/14/r-function-for-little-s-test-for-data-missing-completely-at-random/} -#' using Maximum likelihood estimation from {norm}. +#' using Maximum likelihood estimation from `norm`. #' #' @author Andrew Heiss, \email{andrew@andrewheiss.com} #' diff --git a/man/mcar_test.Rd b/man/mcar_test.Rd index 026ea528..4cc12e05 100644 --- a/man/mcar_test.Rd +++ b/man/mcar_test.Rd @@ -25,10 +25,10 @@ value and low p-value, we can conclude the \code{airquality} data is not missing completely at random. } \note{ -Code is adapted from LittleMCAR() in the now-orphaned {BaylorEdPsych} +Code is adapted from LittleMCAR() in the now-orphaned \code{BaylorEdPsych} package: \url{https://rdrr.io/cran/BaylorEdPsych/man/LittleMCAR.html}. Some of code is adapted from Eric Stemmler: \url{https://web.archive.org/web/20201120030409/https://stats-bayes.com/post/2020/08/14/r-function-for-little-s-test-for-data-missing-completely-at-random/} -using Maximum likelihood estimation from {norm}. +using Maximum likelihood estimation from \code{norm}. } \examples{ mcar_test(airquality) From 425501975fefd169b18847ecba9856c4614b47bb Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 4 Mar 2024 14:36:01 +1100 Subject: [PATCH 2/6] build_readme() --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5bffb503..ec007a67 100644 --- a/README.md +++ b/README.md @@ -310,7 +310,7 @@ which both return output ordered by the number of missing values. miss_var_summary(airquality) #> # A tibble: 6 × 3 #> variable n_miss pct_miss -#> +#> #> 1 Ozone 37 24.2 #> 2 Solar.R 7 4.58 #> 3 Wind 0 0 @@ -354,7 +354,7 @@ airquality %>% #> # A tibble: 25 × 4 #> # Groups: Month [5] #> Month variable n_miss pct_miss -#> +#> #> 1 5 Ozone 5 16.1 #> 2 5 Solar.R 4 12.9 #> 3 5 Wind 0 0 From 01b6d76ce93a9c29cddc775a3f08afcb1fcec33c Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 4 Mar 2024 15:17:26 +1100 Subject: [PATCH 3/6] update test and check functions * to use `call = rlang::caller_env()` * update snapshots for errors --- R/add-cols.R | 4 +- R/cast-shadows.R | 8 +- R/utils.R | 51 ++++--- tests/testthat/_snaps/add-shadow.md | 8 +- tests/testthat/_snaps/add-shadow.new.md | 9 -- tests/testthat/_snaps/as-shadow.md | 8 +- .../_snaps/cast-shadow-shift-label.md | 8 +- tests/testthat/_snaps/cast-shadow-shift.md | 8 +- tests/testthat/_snaps/defunct.md | 45 +++--- tests/testthat/_snaps/gather-shadow.md | 15 +- .../gg-miss-case-cumsum.svg | 2 +- .../_snaps/gg-miss-fct/gg-miss-fct.svg | 22 +-- .../gg-miss-var-cumsum/gg-miss-var-cumsum.svg | 2 +- tests/testthat/_snaps/impute-below.md | 10 +- tests/testthat/_snaps/impute-median.md | 30 ++-- tests/testthat/_snaps/impute_mean.md | 60 +++++--- tests/testthat/_snaps/label-miss-1d.md | 5 +- tests/testthat/_snaps/label-miss-2d.md | 15 +- tests/testthat/_snaps/miss-case-summary.md | 20 ++- tests/testthat/_snaps/miss-case-table.md | 20 ++- tests/testthat/_snaps/miss-prop-summary.md | 20 ++- tests/testthat/_snaps/miss-scan-count.md | 10 +- tests/testthat/_snaps/miss-summary.md | 20 ++- tests/testthat/_snaps/miss-var-summary.md | 10 +- tests/testthat/_snaps/miss-var-table.md | 20 ++- tests/testthat/_snaps/miss-var-which.md | 5 +- tests/testthat/_snaps/miss-x-pct.md | 140 +++++++++++------- tests/testthat/_snaps/nabular.md | 20 ++- tests/testthat/_snaps/prop_row.md | 40 +++-- .../_snaps/replace-with-na-scoped-var.md | 10 +- tests/testthat/_snaps/set-n-prop-miss.md | 40 +++-- tests/testthat/_snaps/shade.md | 20 ++- tests/testthat/_snaps/shadow-shift.md | 15 +- .../testthat/_snaps/special-missing-values.md | 10 +- 34 files changed, 427 insertions(+), 303 deletions(-) delete mode 100644 tests/testthat/_snaps/add-shadow.new.md diff --git a/R/add-cols.R b/R/add-cols.R index b168101d..d8d4f32e 100644 --- a/R/add-cols.R +++ b/R/add-cols.R @@ -21,8 +21,8 @@ add_shadow <- function(data, ...){ test_if_dots_missing( - missing(...), - "{.fun add_shadow} requires variables to be selected" + dots_empty = missing(...), + msg = "{.fun add_shadow} requires variables to be selected" ) shadow_df <- dplyr::select(data, ...) %>% as_shadow() diff --git a/R/cast-shadows.R b/R/cast-shadows.R index a9cc9eb9..10a4fb8e 100644 --- a/R/cast-shadows.R +++ b/R/cast-shadows.R @@ -36,8 +36,8 @@ cast_shadow <- function(data, ...){ test_if_dots_missing( - ..., - "{.fun cast_shadow} requires variables to be selected after the data" + dots_empty = missing(...), + msg = "{.fun cast_shadow} requires variables to be selected after the data" ) shadow_vars <- tibble::as_tibble(as_shadow(dplyr::select(data, ...))) @@ -108,8 +108,8 @@ cast_shadow_shift <- function(data, ...){ cast_shadow_shift_label <- function(data, ...){ test_if_dots_missing( - ..., - "{.fun cast_shadow_shift_label} requires variables to be selected after the data" + dots_empty = missing(...), + msg = "{.fun cast_shadow_shift_label} requires variables to be selected after the data" ) shadow_vars <- dplyr::select(data, ...) %>% cast_shadow(...) diff --git a/R/utils.R b/R/utils.R index 6100cc14..ff195851 100644 --- a/R/utils.R +++ b/R/utils.R @@ -54,14 +54,16 @@ group_by_fun <- function(data, .fun, ...) { #' } #' @keywords internal #' @noRd -test_if_null <- function(x) { +test_if_null <- function(x, + call = rlang::caller_env()) { # test for null if (is.null(x)) { cli::cli_abort( - c( + message = c( "Input must not be NULL", "Input is {.cls {class(x)}}" - ) + ), + call = call ) } } @@ -128,27 +130,32 @@ test_if_dots_missing <- function(dots_empty, #' #' @keywords internal #' @noRd -test_if_dataframe <- function(x) { +test_if_dataframe <- function(x, + arg = rlang::caller_arg(x), + call = rlang::caller_env()) { # test for dataframe if (!inherits(x, "data.frame")) { cli::cli_abort( - c( + message = c( "Input must inherit from {.cls data.frame}", "We see class: {.cls {class(x)}}" - ) + ), + call = call ) } } -test_if_any_shade <- function(x) { +test_if_any_shade <- function(x, + call = rlang::caller_env()) { # test for dataframe test_if_dataframe(x) if (!any_shade(x)) { - cli::format_error( - c( + cli::cli_abort( + message = c( "Input must contain a shade column.", "See {.code ?shade}, {.code ?shade}, and {.code ?bind_shadow}" - ) + ), + call = call ) } } @@ -251,36 +258,42 @@ vecIsFALSE <- Vectorize(isFALSE) are_any_false <- function(x, ...) any(vecIsFALSE(x), ...) -check_btn_0_1 <- function(prop) { +check_btn_0_1 <- function(prop, + call = rlang::caller_env()) { if (prop < 0 || prop > 1) { cli::cli_abort( - c( + message = c( "{.var prop} must be between 0 and 1", "{.var prop} is {prop}" - ) + ), + call = call ) } } -check_is_integer <- function(x) { +check_is_integer <- function(x, + call = rlang::caller_env()) { if (x < 0) { cli::cli_abort( - c( + message = c( "{.var x} must be greater than 0", "{.var x} is {.val {x}}" - ) + ), + call = call ) } vctrs::vec_cast(x, integer()) } -check_is_scalar <- function(x) { +check_is_scalar <- function(x, + call = rlang::caller_env()) { if (length(x) != 1) { cli::cli_abort( - c( + message = c( "{.var x} must be length 1", "{.var x} is {x}, and {.var x} has length: {length(x)}" - ) + ), + call = call ) } } diff --git a/tests/testthat/_snaps/add-shadow.md b/tests/testthat/_snaps/add-shadow.md index c5288c42..5103a043 100644 --- a/tests/testthat/_snaps/add-shadow.md +++ b/tests/testthat/_snaps/add-shadow.md @@ -2,8 +2,8 @@ Code add_shadow(dat) - Warning - The `value` argument of `names<-` must have the same length as `x` as of tibble 3.0.0. - Error - Can't recycle `..1` (size 5) to match `..2` (size 0). + Condition + Error in `add_shadow()`: + ! argument must be specified + {.fun add_shadow} requires variables to be selected diff --git a/tests/testthat/_snaps/add-shadow.new.md b/tests/testthat/_snaps/add-shadow.new.md deleted file mode 100644 index 5103a043..00000000 --- a/tests/testthat/_snaps/add-shadow.new.md +++ /dev/null @@ -1,9 +0,0 @@ -# add_shadow returns a nice error message when no variables are provided - - Code - add_shadow(dat) - Condition - Error in `add_shadow()`: - ! argument must be specified - {.fun add_shadow} requires variables to be selected - diff --git a/tests/testthat/_snaps/as-shadow.md b/tests/testthat/_snaps/as-shadow.md index 2edb4b2b..da04ca80 100644 --- a/tests/testthat/_snaps/as-shadow.md +++ b/tests/testthat/_snaps/as-shadow.md @@ -3,7 +3,7 @@ Code as_shadow(0) Condition - Error in `test_if_dataframe()`: + Error in `as_shadow()`: ! Input must inherit from We see class: @@ -12,7 +12,7 @@ Code as_shadow("a") Condition - Error in `test_if_dataframe()`: + Error in `as_shadow()`: ! Input must inherit from We see class: @@ -21,7 +21,7 @@ Code as_shadow(matrix(airquality)) Condition - Error in `test_if_dataframe()`: + Error in `as_shadow()`: ! Input must inherit from We see class: @@ -30,7 +30,7 @@ Code as_shadow(NULL) Condition - Error in `test_if_null()`: + Error in `as_shadow()`: ! Input must not be NULL Input is diff --git a/tests/testthat/_snaps/cast-shadow-shift-label.md b/tests/testthat/_snaps/cast-shadow-shift-label.md index 5c92cd86..3135e5dc 100644 --- a/tests/testthat/_snaps/cast-shadow-shift-label.md +++ b/tests/testthat/_snaps/cast-shadow-shift-label.md @@ -2,8 +2,8 @@ Code cast_shadow_shift(airquality) - Warning - The `value` argument of `names<-` must have the same length as `x` as of tibble 3.0.0. - Error - Can't recycle `..1` (size 153) to match `..2` (size 0). + Condition + Error in `cast_shadow()`: + ! argument must be specified + {.fun cast_shadow} requires variables to be selected after the data diff --git a/tests/testthat/_snaps/cast-shadow-shift.md b/tests/testthat/_snaps/cast-shadow-shift.md index 4a8d450b..3b9c5009 100644 --- a/tests/testthat/_snaps/cast-shadow-shift.md +++ b/tests/testthat/_snaps/cast-shadow-shift.md @@ -2,8 +2,8 @@ Code cast_shadow_shift(airquality) - Warning - The `value` argument of `names<-` must have the same length as `x` as of tibble 3.0.0. - Error - Can't recycle `..1` (size 153) to match `..2` (size 0). + Condition + Error in `cast_shadow()`: + ! argument must be specified + {.fun cast_shadow} requires variables to be selected after the data diff --git a/tests/testthat/_snaps/defunct.md b/tests/testthat/_snaps/defunct.md index a197fb37..b01b14a0 100644 --- a/tests/testthat/_snaps/defunct.md +++ b/tests/testthat/_snaps/defunct.md @@ -2,8 +2,9 @@ Code miss_var_prop(df) - Error - 'miss_var_prop' is defunct. + Condition + Error: + ! 'miss_var_prop' is defunct. Use 'prop_miss_var' instead. See help("Defunct") @@ -11,8 +12,9 @@ Code complete_var_prop(df) - Error - 'complete_var_prop' is defunct. + Condition + Error: + ! 'complete_var_prop' is defunct. Use 'prop_complete_var' instead. See help("Defunct") @@ -20,8 +22,9 @@ Code miss_var_pct(df) - Error - 'miss_var_pct' is defunct. + Condition + Error: + ! 'miss_var_pct' is defunct. Use 'pct_miss_var' instead. See help("Defunct") @@ -29,8 +32,9 @@ Code complete_var_pct(df) - Error - 'complete_var_pct' is defunct. + Condition + Error: + ! 'complete_var_pct' is defunct. Use 'pct_complete_var' instead. See help("Defunct") @@ -38,8 +42,9 @@ Code miss_case_prop(df) - Error - 'miss_case_prop' is defunct. + Condition + Error: + ! 'miss_case_prop' is defunct. Use 'prop_miss_case' instead. See help("Defunct") @@ -47,8 +52,9 @@ Code complete_case_prop(df) - Error - 'complete_case_prop' is defunct. + Condition + Error: + ! 'complete_case_prop' is defunct. Use 'prop_complete_case' instead. See help("Defunct") @@ -56,8 +62,9 @@ Code miss_case_pct(df) - Error - 'miss_case_pct' is defunct. + Condition + Error: + ! 'miss_case_pct' is defunct. Use 'pct_miss_case' instead. See help("Defunct") @@ -65,8 +72,9 @@ Code complete_case_pct(df) - Error - 'complete_case_pct' is defunct. + Condition + Error: + ! 'complete_case_pct' is defunct. Use 'pct_complete_case' instead. See help("Defunct") @@ -74,8 +82,9 @@ Code replace_to_na(df) - Error - 'replace_to_na' is defunct. + Condition + Error: + ! 'replace_to_na' is defunct. Use 'replace_with_na' instead. See help("Defunct") diff --git a/tests/testthat/_snaps/gather-shadow.md b/tests/testthat/_snaps/gather-shadow.md index b03371aa..587f3c57 100644 --- a/tests/testthat/_snaps/gather-shadow.md +++ b/tests/testthat/_snaps/gather-shadow.md @@ -2,23 +2,26 @@ Code gather_shadow(0) - Error - Input must inherit from + Condition + Error in `as_shadow()`: + ! Input must inherit from We see class: --- Code gather_shadow(matrix(0)) - Error - Input must inherit from + Condition + Error in `as_shadow()`: + ! Input must inherit from We see class: --- Code gather_shadow(NULL) - Error - Input must not be NULL + Condition + Error in `as_shadow()`: + ! Input must not be NULL Input is diff --git a/tests/testthat/_snaps/gg-miss-case-cumsum/gg-miss-case-cumsum.svg b/tests/testthat/_snaps/gg-miss-case-cumsum/gg-miss-case-cumsum.svg index 4eb95387..c78880fd 100644 --- a/tests/testthat/_snaps/gg-miss-case-cumsum/gg-miss-case-cumsum.svg +++ b/tests/testthat/_snaps/gg-miss-case-cumsum/gg-miss-case-cumsum.svg @@ -18,7 +18,7 @@ - + diff --git a/tests/testthat/_snaps/gg-miss-fct/gg-miss-fct.svg b/tests/testthat/_snaps/gg-miss-fct/gg-miss-fct.svg index 5ed7b2c2..2ae4f30d 100644 --- a/tests/testthat/_snaps/gg-miss-fct/gg-miss-fct.svg +++ b/tests/testthat/_snaps/gg-miss-fct/gg-miss-fct.svg @@ -55,23 +55,23 @@ 2.5 month variable +% Miss + + + + + + + + + + 0 25 50 75 100 -% Miss - - - - - - - - - - gg_miss_fct diff --git a/tests/testthat/_snaps/gg-miss-var-cumsum/gg-miss-var-cumsum.svg b/tests/testthat/_snaps/gg-miss-var-cumsum/gg-miss-var-cumsum.svg index 276e5d99..2f4f063e 100644 --- a/tests/testthat/_snaps/gg-miss-var-cumsum/gg-miss-var-cumsum.svg +++ b/tests/testthat/_snaps/gg-miss-var-cumsum/gg-miss-var-cumsum.svg @@ -18,7 +18,7 @@ - + diff --git a/tests/testthat/_snaps/impute-below.md b/tests/testthat/_snaps/impute-below.md index 2bfd8147..c6cf9f03 100644 --- a/tests/testthat/_snaps/impute-below.md +++ b/tests/testthat/_snaps/impute-below.md @@ -2,15 +2,17 @@ Code impute_below(0+3i) - Error - `impute_below()` does not know how to deal with data of class + Condition + Error in `impute_below()`: + ! `impute_below()` does not know how to deal with data of class Check if your input is more than length one, and that you are using the right function. Perhaps you meant to apply this to many variables in a data frame? See the examples dor details on doing this with `across()` # impute_below_all errors when given wrong object Code impute_below_all(as.POSIXct(111, origin = "1970-01-01")) - Error - Input must inherit from + Condition + Error in `impute_below_all()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/impute-median.md b/tests/testthat/_snaps/impute-median.md index 671870f9..e65508f3 100644 --- a/tests/testthat/_snaps/impute-median.md +++ b/tests/testthat/_snaps/impute-median.md @@ -2,47 +2,53 @@ Code impute_median_if(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_median_if()`: + ! Input must inherit from We see class: --- Code impute_median_at(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_median_at()`: + ! Input must inherit from We see class: --- Code impute_median_all(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_median_all()`: + ! Input must inherit from We see class: --- Code impute_median_if(NULL) - Error - Input must inherit from + Condition + Error in `impute_median_if()`: + ! Input must inherit from We see class: --- Code impute_median_at(NULL) - Error - Input must inherit from + Condition + Error in `impute_median_at()`: + ! Input must inherit from We see class: --- Code impute_mean_all(NULL) - Error - Input must inherit from + Condition + Error in `impute_mean_all()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/impute_mean.md b/tests/testthat/_snaps/impute_mean.md index 79b82c43..1ab1953e 100644 --- a/tests/testthat/_snaps/impute_mean.md +++ b/tests/testthat/_snaps/impute_mean.md @@ -2,95 +2,107 @@ Code impute_mean_if(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_mean_if()`: + ! Input must inherit from We see class: --- Code impute_mean_at(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_mean_at()`: + ! Input must inherit from We see class: --- Code impute_mean_all(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_mean_all()`: + ! Input must inherit from We see class: --- Code impute_mean_if(NULL) - Error - Input must inherit from + Condition + Error in `impute_mean_if()`: + ! Input must inherit from We see class: --- Code impute_mean_at(NULL) - Error - Input must inherit from + Condition + Error in `impute_mean_at()`: + ! Input must inherit from We see class: --- Code impute_mean_all(NULL) - Error - Input must inherit from + Condition + Error in `impute_mean_all()`: + ! Input must inherit from We see class: --- Code impute_mean_if(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_mean_if()`: + ! Input must inherit from We see class: --- Code impute_mean_at(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_mean_at()`: + ! Input must inherit from We see class: --- Code impute_mean_all(numeric(0)) - Error - Input must inherit from + Condition + Error in `impute_mean_all()`: + ! Input must inherit from We see class: --- Code impute_mean_if(NULL) - Error - Input must inherit from + Condition + Error in `impute_mean_if()`: + ! Input must inherit from We see class: --- Code impute_mean_at(NULL) - Error - Input must inherit from + Condition + Error in `impute_mean_at()`: + ! Input must inherit from We see class: --- Code impute_mean_all(NULL) - Error - Input must inherit from + Condition + Error in `impute_mean_all()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/label-miss-1d.md b/tests/testthat/_snaps/label-miss-1d.md index 86635741..5984dd97 100644 --- a/tests/testthat/_snaps/label-miss-1d.md +++ b/tests/testthat/_snaps/label-miss-1d.md @@ -2,8 +2,9 @@ Code label_miss_1d(NULL) - Error - Input must not be NULL + Condition + Error in `label_miss_1d()`: + ! Input must not be NULL Input is # label_miss_1d identifies the correct location of missingness diff --git a/tests/testthat/_snaps/label-miss-2d.md b/tests/testthat/_snaps/label-miss-2d.md index 30b43b70..38e00e03 100644 --- a/tests/testthat/_snaps/label-miss-2d.md +++ b/tests/testthat/_snaps/label-miss-2d.md @@ -2,8 +2,9 @@ Code label_miss_2d(NULL, 3) - Error - Input cannot be NULL + Condition + Error in `label_miss_2d()`: + ! Input cannot be NULL We see the first argument, `x1` is: We see the second argument, `x2` is: @@ -11,8 +12,9 @@ Code label_miss_2d(3, NULL) - Error - Input cannot be NULL + Condition + Error in `label_miss_2d()`: + ! Input cannot be NULL We see the first argument, `x1` is: We see the second argument, `x2` is: @@ -20,8 +22,9 @@ Code label_miss_2d(NULL, NULL) - Error - Input cannot be NULL + Condition + Error in `label_miss_2d()`: + ! Input cannot be NULL We see the first argument, `x1` is: We see the second argument, `x2` is: diff --git a/tests/testthat/_snaps/miss-case-summary.md b/tests/testthat/_snaps/miss-case-summary.md index 63f07503..bf665b70 100644 --- a/tests/testthat/_snaps/miss-case-summary.md +++ b/tests/testthat/_snaps/miss-case-summary.md @@ -2,31 +2,35 @@ Code miss_case_summary(NULL) - Error - Input must not be NULL + Condition + Error in `miss_case_summary()`: + ! Input must not be NULL Input is # miss_case_summary errors when a non-dataframe given Code miss_case_summary(1) - Error - Input must inherit from + Condition + Error in `miss_case_summary()`: + ! Input must inherit from We see class: --- Code miss_case_summary("a") - Error - Input must inherit from + Condition + Error in `miss_case_summary()`: + ! Input must inherit from We see class: --- Code miss_case_summary(matrix(0)) - Error - Input must inherit from + Condition + Error in `miss_case_summary()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/miss-case-table.md b/tests/testthat/_snaps/miss-case-table.md index a1a7e7c7..41a45335 100644 --- a/tests/testthat/_snaps/miss-case-table.md +++ b/tests/testthat/_snaps/miss-case-table.md @@ -2,31 +2,35 @@ Code miss_case_table(NULL) - Error - Input must not be NULL + Condition + Error in `miss_case_table()`: + ! Input must not be NULL Input is --- Code miss_case_table(1) - Error - Input must inherit from + Condition + Error in `miss_case_table()`: + ! Input must inherit from We see class: --- Code miss_case_table("a") - Error - Input must inherit from + Condition + Error in `miss_case_table()`: + ! Input must inherit from We see class: --- Code miss_case_table(matrix(0)) - Error - Input must inherit from + Condition + Error in `miss_case_table()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/miss-prop-summary.md b/tests/testthat/_snaps/miss-prop-summary.md index 014283df..ff24ee49 100644 --- a/tests/testthat/_snaps/miss-prop-summary.md +++ b/tests/testthat/_snaps/miss-prop-summary.md @@ -2,31 +2,35 @@ Code miss_prop_summary(0) - Error - Input must inherit from + Condition + Error in `miss_prop_summary()`: + ! Input must inherit from We see class: --- Code miss_prop_summary("a") - Error - Input must inherit from + Condition + Error in `miss_prop_summary()`: + ! Input must inherit from We see class: --- Code miss_prop_summary(matrix(airquality)) - Error - Input must inherit from + Condition + Error in `miss_prop_summary()`: + ! Input must inherit from We see class: --- Code miss_prop_summary(NULL) - Error - Input must not be NULL + Condition + Error in `miss_prop_summary()`: + ! Input must not be NULL Input is diff --git a/tests/testthat/_snaps/miss-scan-count.md b/tests/testthat/_snaps/miss-scan-count.md index c4835855..05ea1758 100644 --- a/tests/testthat/_snaps/miss-scan-count.md +++ b/tests/testthat/_snaps/miss-scan-count.md @@ -2,13 +2,15 @@ Code miss_scan_count(dat_ms) - Error - argument "search" is missing, with no default + Condition + Error in `miss_scan_count()`: + ! argument "search" is missing, with no default # miss_scan_count returns an error when no data is provided Code miss_scan_count(search = -99) - Error - argument "data" is missing, with no default + Condition + Error in `miss_scan_count()`: + ! argument "data" is missing, with no default diff --git a/tests/testthat/_snaps/miss-summary.md b/tests/testthat/_snaps/miss-summary.md index 757c6f2b..4bf59c44 100644 --- a/tests/testthat/_snaps/miss-summary.md +++ b/tests/testthat/_snaps/miss-summary.md @@ -2,31 +2,35 @@ Code miss_summary(0) - Error - Input must inherit from + Condition + Error in `miss_summary()`: + ! Input must inherit from We see class: --- Code miss_summary("a") - Error - Input must inherit from + Condition + Error in `miss_summary()`: + ! Input must inherit from We see class: --- Code miss_summary(matrix(airquality)) - Error - Input must inherit from + Condition + Error in `miss_summary()`: + ! Input must inherit from We see class: --- Code miss_summary(NULL) - Error - Input must not be NULL + Condition + Error in `miss_summary()`: + ! Input must not be NULL Input is diff --git a/tests/testthat/_snaps/miss-var-summary.md b/tests/testthat/_snaps/miss-var-summary.md index 536d44b2..38bc5423 100644 --- a/tests/testthat/_snaps/miss-var-summary.md +++ b/tests/testthat/_snaps/miss-var-summary.md @@ -2,15 +2,17 @@ Code miss_var_summary(NULL) - Error - Input must not be NULL + Condition + Error in `miss_var_summary()`: + ! Input must not be NULL Input is --- Code miss_var_summary(matrix(0)) - Error - Input must inherit from + Condition + Error in `miss_var_summary()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/miss-var-table.md b/tests/testthat/_snaps/miss-var-table.md index 70eac598..e16352cd 100644 --- a/tests/testthat/_snaps/miss-var-table.md +++ b/tests/testthat/_snaps/miss-var-table.md @@ -2,31 +2,35 @@ Code miss_var_table(NULL) - Error - Input must not be NULL + Condition + Error in `miss_var_table()`: + ! Input must not be NULL Input is # miss_var_table errors when a non-dataframe given Code miss_var_table(1) - Error - Input must inherit from + Condition + Error in `miss_var_table()`: + ! Input must inherit from We see class: --- Code miss_var_table("a") - Error - Input must inherit from + Condition + Error in `miss_var_table()`: + ! Input must inherit from We see class: --- Code miss_var_table(matrix(0)) - Error - Input must inherit from + Condition + Error in `miss_var_table()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/miss-var-which.md b/tests/testthat/_snaps/miss-var-which.md index f7fd3c56..142a6c0f 100644 --- a/tests/testthat/_snaps/miss-var-which.md +++ b/tests/testthat/_snaps/miss-var-which.md @@ -2,7 +2,8 @@ Code miss_var_which(NULL) - Error - Input must inherit from + Condition + Error in `miss_var_which()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/miss-x-pct.md b/tests/testthat/_snaps/miss-x-pct.md index 7a0a037a..635cbf6d 100644 --- a/tests/testthat/_snaps/miss-x-pct.md +++ b/tests/testthat/_snaps/miss-x-pct.md @@ -2,223 +2,251 @@ Code prop_miss(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss()`: + ! Input must not be NULL Input is --- Code prop_miss_var(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_var()`: + ! Input must not be NULL Input is --- Code prop_miss_case(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_case()`: + ! Input must not be NULL Input is # pct_miss* errors on NULL Code pct_miss(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss()`: + ! Input must not be NULL Input is --- Code pct_miss_var(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_var()`: + ! Input must not be NULL Input is --- Code pct_miss_case(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_case()`: + ! Input must not be NULL Input is # prop_complete* errors on NULL Code prop_complete(NULL) - Error - Input must not be NULL + Condition + Error in `prop_complete()`: + ! Input must not be NULL Input is --- Code prop_complete_var(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_var()`: + ! Input must not be NULL Input is --- Code prop_complete_case(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_case()`: + ! Input must not be NULL Input is # pct_complete* errors on NULL Code pct_complete(NULL) - Error - Input must not be NULL + Condition + Error in `pct_complete()`: + ! Input must not be NULL Input is --- Code pct_complete_var(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_var()`: + ! Input must not be NULL Input is --- Code pct_complete_case(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_case()`: + ! Input must not be NULL Input is # prop_miss* errors when a non-dataframe given Code prop_miss_var(1) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code prop_miss_var(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code prop_miss_case(1) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: --- Code prop_miss_case(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: # prop_complete* errors when a non-dataframe given Code prop_complete_var(1) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code prop_complete_var(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code prop_complete_case(1) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: --- Code prop_complete_case(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: # pct_miss* errors when a non-dataframe given Code pct_miss_var(1) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code pct_miss_var(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code pct_miss_case(1) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: --- Code pct_miss_case(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: # pct_complete* errors when a non-dataframe given Code pct_complete_var(1) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code pct_complete_var(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_var()`: + ! Input must inherit from We see class: --- Code pct_complete_case(1) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: --- Code pct_complete_case(matrix(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_case()`: + ! Input must inherit from We see class: diff --git a/tests/testthat/_snaps/nabular.md b/tests/testthat/_snaps/nabular.md index a9f89de0..47264833 100644 --- a/tests/testthat/_snaps/nabular.md +++ b/tests/testthat/_snaps/nabular.md @@ -2,31 +2,35 @@ Code nabular(0) - Error - Input must inherit from + Condition + Error in `as_shadow()`: + ! Input must inherit from We see class: --- Code nabular("a") - Error - Input must inherit from + Condition + Error in `as_shadow()`: + ! Input must inherit from We see class: --- Code nabular(matrix(0)) - Error - Input must inherit from + Condition + Error in `as_shadow()`: + ! Input must inherit from We see class: --- Code nabular(NULL) - Error - Input must not be NULL + Condition + Error in `as_shadow()`: + ! Input must not be NULL Input is diff --git a/tests/testthat/_snaps/prop_row.md b/tests/testthat/_snaps/prop_row.md index e4ec9170..bdab6d16 100644 --- a/tests/testthat/_snaps/prop_row.md +++ b/tests/testthat/_snaps/prop_row.md @@ -2,63 +2,71 @@ Code n_miss_row(numeric(0)) - Error - Input must inherit from + Condition + Error in `n_miss_row()`: + ! Input must inherit from We see class: --- Code n_miss_row(NULL) - Error - Input must not be NULL + Condition + Error in `n_miss_row()`: + ! Input must not be NULL Input is --- Code n_complete_row(numeric(0)) - Error - Input must inherit from + Condition + Error in `n_complete_row()`: + ! Input must inherit from We see class: --- Code n_complete_row(NULL) - Error - Input must not be NULL + Condition + Error in `n_complete_row()`: + ! Input must not be NULL Input is --- Code prop_miss_row(numeric(0)) - Error - Input must inherit from + Condition + Error in `prop_miss_row()`: + ! Input must inherit from We see class: --- Code prop_miss_row(NULL) - Error - Input must not be NULL + Condition + Error in `prop_miss_row()`: + ! Input must not be NULL Input is --- Code prop_complete_row(numeric(0)) - Error - Input must inherit from + Condition + Error in `prop_complete_row()`: + ! Input must inherit from We see class: --- Code prop_complete_row(NULL) - Error - Input must not be NULL + Condition + Error in `prop_complete_row()`: + ! Input must not be NULL Input is diff --git a/tests/testthat/_snaps/replace-with-na-scoped-var.md b/tests/testthat/_snaps/replace-with-na-scoped-var.md index fcfcde80..5adf8ab3 100644 --- a/tests/testthat/_snaps/replace-with-na-scoped-var.md +++ b/tests/testthat/_snaps/replace-with-na-scoped-var.md @@ -2,6 +2,12 @@ Code replace_with_na_all(df) - Error - argument "condition" is missing, with no default + Condition + Error in `map()`: + i In index: 1. + i With name: x. + Caused by error: + ! Failed to evaluate glue component {rlang::f_text(condition)} + Caused by error in `.f()`: + ! argument "condition" is missing, with no default diff --git a/tests/testthat/_snaps/set-n-prop-miss.md b/tests/testthat/_snaps/set-n-prop-miss.md index 2c1dd50b..1c71fbee 100644 --- a/tests/testthat/_snaps/set-n-prop-miss.md +++ b/tests/testthat/_snaps/set-n-prop-miss.md @@ -2,62 +2,70 @@ Code set_n_miss(vec, -1) - Error - `x` must be greater than 0 + Condition + Error in `set_n_miss()`: + ! `x` must be greater than 0 `x` is -1 --- Code set_n_miss(vec, "a") - Error - Can't convert `x` to . + Condition + Error in `check_is_integer()`: + ! Can't convert `x` to . --- Code set_n_miss(vec, 1.5) - Error - Can't convert from `x` to due to loss of precision. + Condition + Error in `check_is_integer()`: + ! Can't convert from `x` to due to loss of precision. * Locations: 1 --- Code set_n_miss(vec, c(1.5, 2)) - Error - `x` must be length 1 + Condition + Error in `set_n_miss()`: + ! `x` must be length 1 `x` is 1.5 and 2, and `x` has length: 2 # set_prop_miss errors appropriately Code set_prop_miss(vec, -1) - Error - `prop` must be between 0 and 1 + Condition + Error in `set_prop_miss()`: + ! `prop` must be between 0 and 1 `prop` is -1 --- Code set_prop_miss(vec, "a") - Error - `prop` must be between 0 and 1 + Condition + Error in `set_prop_miss()`: + ! `prop` must be between 0 and 1 `prop` is a --- Code set_prop_miss(vec, 1.5) - Error - `prop` must be between 0 and 1 + Condition + Error in `set_prop_miss()`: + ! `prop` must be between 0 and 1 `prop` is 1.5 --- Code set_prop_miss(vec, c(1.5, 2)) - Error - `x` must be length 1 + Condition + Error in `set_prop_miss()`: + ! `x` must be length 1 `x` is 1.5 and 2, and `x` has length: 2 diff --git a/tests/testthat/_snaps/shade.md b/tests/testthat/_snaps/shade.md index baa5ea4a..bcc098ce 100644 --- a/tests/testthat/_snaps/shade.md +++ b/tests/testthat/_snaps/shade.md @@ -2,28 +2,32 @@ Code shade(NULL) - Error - Input must not be NULL + Condition + Error in `shade()`: + ! Input must not be NULL Input is # shade errors with objects of length 0 Code shade(numeric(0)) - Error - input to shade must have length > 0 + Condition + Error in `shade()`: + ! input to shade must have length > 0 # shade errors with list of length 0 Code shade(list()) - Error - input to shade must have length > 0 + Condition + Error in `shade()`: + ! input to shade must have length > 0 # shade returns the correct values with list columns Code shade(list(3, list(1), c(2, 3), list()), broken = 3) - Error - additional levels of missing are not available when shade-ing lists column + Condition + Error in `shade()`: + ! additional levels of missing are not available when shade-ing lists column diff --git a/tests/testthat/_snaps/shadow-shift.md b/tests/testthat/_snaps/shadow-shift.md index 21d36123..75c8540f 100644 --- a/tests/testthat/_snaps/shadow-shift.md +++ b/tests/testthat/_snaps/shadow-shift.md @@ -2,7 +2,8 @@ Code shadow_shift(NULL) - Warning + Condition + Warning: `shadow_shift()` was deprecated in naniar 1.1.0. i Please use `impute_below()` instead. Output @@ -12,11 +13,12 @@ Code shadow_shift(0+3i) - Warning + Condition + Warning: `shadow_shift()` was deprecated in naniar 1.1.0. i Please use `impute_below()` instead. - Error - `impute_below()` does not know how to deal with data of class + Error in `impute_below()`: + ! `impute_below()` does not know how to deal with data of class Check if your input is more than length one, and that you are using the right function. Perhaps you meant to apply this to many variables in a data frame? See the examples dor details on doing this with `across()` --- @@ -35,8 +37,9 @@ Code shadow_shift(0+3i) - Error - `impute_below()` does not know how to deal with data of class + Condition + Error in `impute_below()`: + ! `impute_below()` does not know how to deal with data of class Check if your input is more than length one, and that you are using the right function. Perhaps you meant to apply this to many variables in a data frame? See the examples dor details on doing this with `across()` --- diff --git a/tests/testthat/_snaps/special-missing-values.md b/tests/testthat/_snaps/special-missing-values.md index 588a0f24..93374b27 100644 --- a/tests/testthat/_snaps/special-missing-values.md +++ b/tests/testthat/_snaps/special-missing-values.md @@ -2,10 +2,8 @@ Code recode_shadow(df, temp = .where(wind == -99 ~ "bananas")) - Error - i In argument: `temp_NA = structure(...)`. - Caused by error in `dplyr::case_when()`: - ! Failed to evaluate the right-hand side of formula 2. - Caused by error: - ! object 'temp_NA' not found + Condition + Error in `recode_shadow()`: + ! Input must contain a shade column. + See `?shade`, `?shade`, and `?bind_shadow` From 65647bc2a3fa38e8343bb4e6a16acad87b2ad222 Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 4 Mar 2024 15:40:40 +1100 Subject: [PATCH 4/6] revdep checks --- revdep/README.md | 31 ++++++++++++++++--------------- revdep/cran.md | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/revdep/README.md b/revdep/README.md index c3aec2ec..65638f77 100644 --- a/revdep/README.md +++ b/revdep/README.md @@ -1,25 +1,26 @@ # Platform -|field |value | -|:--------|:-------------------------------------------------------------------------------------------| -|version |R version 4.2.1 (2022-06-23) | -|os |macOS Monterey 12.3.1 | -|system |aarch64, darwin20 | -|ui |RStudio | -|language |(EN) | -|collate |en_US.UTF-8 | -|ctype |en_US.UTF-8 | -|tz |Australia/Hobart | -|date |2023-02-01 | -|rstudio |2022.12.0+353 Elsbeth Geranium (desktop) | -|pandoc |2.19.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown) | +|field |value | +|:--------|:-----------------------------------| +|version |R version 4.3.3 (2024-02-29) | +|os |macOS Sonoma 14.3.1 | +|system |aarch64, darwin20 | +|ui |RStudio | +|language |(EN) | +|collate |en_US.UTF-8 | +|ctype |en_US.UTF-8 | +|tz |Australia/Melbourne | +|date |2024-03-04 | +|rstudio |2023.12.1+402 Ocean Storm (desktop) | +|pandoc |NA | # Dependencies |package |old |new |Δ | |:-------|:-----|:-----|:--| -|naniar |0.6.1 |0.9.0 |* | -|forcats |NA |1.0.0 |* | +|naniar |1.0.0 |1.1.0 |* | +|ggplot2 |NA |3.5.0 |* | +|viridis |NA |0.6.5 |* | # Revdeps diff --git a/revdep/cran.md b/revdep/cran.md index 01f3ff69..5b113efb 100644 --- a/revdep/cran.md +++ b/revdep/cran.md @@ -1,6 +1,6 @@ ## revdepcheck results -We checked 3 reverse dependencies (2 from CRAN + 1 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package. +We checked 6 reverse dependencies (5 from CRAN + 1 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package. * We saw 0 new problems * We failed to check 0 packages From 497128d576c43140b1f600f6f0cbee157e79cfa1 Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 4 Mar 2024 15:44:52 +1100 Subject: [PATCH 5/6] revdep checks --- cran-comments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index 5dd71172..16cf6329 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -39,7 +39,7 @@ The other links all work locally for me on my machine, and checking with `wget` ## Reverse dependencies -We checked 3 reverse dependencies (2 from CRAN + 1 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package. +We checked 6 reverse dependencies (5 from CRAN + 1 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package. * We saw 0 new problems * We failed to check 0 packages From d62680f3f0d1b3e045dec363c90bc3a46cab192c Mon Sep 17 00:00:00 2001 From: njtierney Date: Mon, 4 Mar 2024 15:48:16 +1100 Subject: [PATCH 6/6] update CRAN comments --- cran-comments.md | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index 16cf6329..f6604b12 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -9,33 +9,17 @@ There were no ERRORs or WARNINGs, and one NOTE: ``` Found the following (possibly) invalid URLs: - URL: https://web.archive.org/web/20201120030409/https://stats-bayes.com/post/2020/08/14/r-function-for-little-s-test-for-data-missing-completely-at-random/ - From: man/mcar_test.Rd - Status: Error - Message: Failed to connect to web.archive.org port 443 after 21108 ms: Timed out URL: https://www.ncei.noaa.gov/products/land-based-station/global-historical-climatology-network-daily From: inst/doc/special-missing-values.html Status: Error Message: Empty reply from server - URL: https://www.researchgate.net/publication/2758672_Missing_Data_in_Interactive_High-Dimensional_Data_Visualization - From: man/as_shadow.Rd - inst/doc/getting-started-w-naniar.html - inst/doc/special-missing-values.html - README.md - Status: 403 - Message: Forbidden - -Found the following (possibly) invalid DOIs: - DOI: 10.18637/jss.v105.i07 - From: DESCRIPTION - inst/CITATION - Status: 404 - Message: Not Found ``` -The DOI in the CITATION is for a new JSS publication that will be registered after publication on CRAN. +Navigating to the website works on my machine, but I note that the NCEI website states in a banner: + +> Please note: Due to a system outage, many NCEI systems are currently unavailable. We are working to resolve these issues as soon as possible. We apologize for any inconvenience. -The other links all work locally for me on my machine, and checking with `wget` locally they also work. I'm not sure how to best proceed with these? +Which makes me think that perhaps this is an issue related to that? ## Reverse dependencies