R Under development (unstable) (2025-02-23 r87804 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 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. > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview > # * https://testthat.r-lib.org/articles/special-files.html > > library(testthat) > library(mhqol) > > test_check("mhqol") [ FAIL 5 | WARN 14 | SKIP 0 | PASS 86 ] ══ Failed tests ════════════════════════════════════════════════════════════════ ── Error ('test-mhqol_scores_to_states.R:21:3'): Test whether when ignore_na = TRUE, the function returns a warning when there are NA values in the data ── Error in `dplyr::mutate(scores, SI_s = if ("SI" %in% colnames(scores)) { if (any(SI < 0 | SI > 3, na.rm == TRUE)) stop("Error: SI contains values outside [0,3]") dplyr::case_when(SI == 3 ~ "I think very positively about myself", SI == 2 ~ "I think positively about myself", SI == 1 ~ "I think negatively about myself", SI == 0 ~ "I think very negatively about myself", TRUE ~ NA_character_) } else { NA_character_ }, IN_s = if ("IN" %in% colnames(scores)) { if (any(IN < 0 | IN > 3, na.rm = TRUE)) stop("Error: IN contains values outside [0,3]") dplyr::case_when(IN == 3 ~ "I am very satisfied with my level of independence", IN == 2 ~ "I am satisfied with my level of independence", IN == 1 ~ "I am dissatisfied with my level of independence", IN == 0 ~ "I am very dissatisfied with my level of independence", TRUE ~ NA_character_) } else { NA_character_ }, MO_s = if ("MO" %in% colnames(scores)) { if (any(MO < 0 | MO > 3, na.rm = TRUE)) stop("Error: MO contains values outside [0,3]") dplyr::case_when(MO == 3 ~ "I do not feel anxious, gloomy, or depressed", MO == 2 ~ "I feel a little anxious, gloomy, or depressed", MO == 1 ~ "I feel anxious, gloomy, or depressed", MO == 0 ~ "I feel very anxious, gloomy, or depressed", TRUE ~ NA_character_) } else { NA_character_ }, RE_s = if ("RE" %in% colnames(scores)) { if (any(RE < 0 | RE > 3, na.rm = TRUE)) stop("Error: RE contains values outside [0,3]") dplyr::case_when(RE == 3 ~ "I am very satisfied with my relationships", RE == 2 ~ "I am satisfied with my relationships", RE == 1 ~ "I am dissatisfied with my relationships", RE == 0 ~ "I am very dissatisfied with my relationships", TRUE ~ NA_character_) } else { NA_character_ }, DA_s = if ("DA" %in% colnames(scores)) { if (any(DA < 0 | DA > 3, na.rm = TRUE)) stop("Error: DA contains values outside [0,3]") dplyr::case_when(DA == 3 ~ "I am very satisfied with my daily activities", DA == 2 ~ "I am satisfied with my daily activities", DA == 1 ~ "I am dissatisfied with my daily activities", DA == 0 ~ "I am very dissatisfied with my daily activities", TRUE ~ NA_character_) } else { NA_character_ }, PH_s = if ("PH" %in% colnames(scores)) { if (any(PH < 0 | PH > 3, na.rm = TRUE)) stop("Error: PH contains values outside [0,3]") dplyr::case_when(PH == 3 ~ "I have no physical health problems", PH == 2 ~ "I have some physical health problems", PH == 1 ~ "I have many physical health problems", PH == 0 ~ "I have a great many physical health problems", TRUE ~ NA_character_) } else { NA_character_ }, FU_s = if ("FU" %in% colnames(scores)) { if (any(FU < 0 | FU > 3, na.rm = TRUE)) stop("Error: FU contains values outside [0,3]") dplyr::case_when(FU == 3 ~ "I am very optimistic about my future", FU == 2 ~ "I am optimistic about my future", FU == 1 ~ "I am gloomy about my future", FU == 0 ~ "I am very gloomy about my future", TRUE ~ NA_character_) } else { NA_character_ })`: i In argument: `SI_s = if (...) NULL`. Caused by error: ! object 'na.rm' not found Backtrace: ▆ 1. ├─testthat::expect_warning(...) at test-mhqol_scores_to_states.R:21:3 2. │ └─testthat:::expect_condition_matching(...) 3. │ └─testthat:::quasi_capture(...) 4. │ ├─testthat (local) .capture(...) 5. │ │ └─base::withCallingHandlers(...) 6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) 7. ├─mhqol::mhqol_scores_to_states(...) 8. │ ├─dplyr::mutate(...) 9. │ └─dplyr:::mutate.data.frame(...) 10. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by) 11. │ ├─base::withCallingHandlers(...) 12. │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns) 13. │ └─mask$eval_all_mutate(quo) 14. │ └─dplyr (local) eval() 15. └─base::.handleSimpleError(...) 16. └─dplyr (local) h(simpleError(msg, call)) 17. └─rlang::abort(message, class = error_class, parent = parent, call = error_call) ── Error ('test-mhqol_scores_to_states.R:45:3'): Test whether when ignore_invalid = TRUE, he function does not return an Error but a Warning when there are missing cols in the data ── Error in `dplyr::mutate(scores, SI_s = if ("SI" %in% colnames(scores)) { if (any(SI < 0 | SI > 3, na.rm == TRUE)) stop("Error: SI contains values outside [0,3]") dplyr::case_when(SI == 3 ~ "I think very positively about myself", SI == 2 ~ "I think positively about myself", SI == 1 ~ "I think negatively about myself", SI == 0 ~ "I think very negatively about myself", TRUE ~ NA_character_) } else { NA_character_ }, IN_s = if ("IN" %in% colnames(scores)) { if (any(IN < 0 | IN > 3, na.rm = TRUE)) stop("Error: IN contains values outside [0,3]") dplyr::case_when(IN == 3 ~ "I am very satisfied with my level of independence", IN == 2 ~ "I am satisfied with my level of independence", IN == 1 ~ "I am dissatisfied with my level of independence", IN == 0 ~ "I am very dissatisfied with my level of independence", TRUE ~ NA_character_) } else { NA_character_ }, MO_s = if ("MO" %in% colnames(scores)) { if (any(MO < 0 | MO > 3, na.rm = TRUE)) stop("Error: MO contains values outside [0,3]") dplyr::case_when(MO == 3 ~ "I do not feel anxious, gloomy, or depressed", MO == 2 ~ "I feel a little anxious, gloomy, or depressed", MO == 1 ~ "I feel anxious, gloomy, or depressed", MO == 0 ~ "I feel very anxious, gloomy, or depressed", TRUE ~ NA_character_) } else { NA_character_ }, RE_s = if ("RE" %in% colnames(scores)) { if (any(RE < 0 | RE > 3, na.rm = TRUE)) stop("Error: RE contains values outside [0,3]") dplyr::case_when(RE == 3 ~ "I am very satisfied with my relationships", RE == 2 ~ "I am satisfied with my relationships", RE == 1 ~ "I am dissatisfied with my relationships", RE == 0 ~ "I am very dissatisfied with my relationships", TRUE ~ NA_character_) } else { NA_character_ }, DA_s = if ("DA" %in% colnames(scores)) { if (any(DA < 0 | DA > 3, na.rm = TRUE)) stop("Error: DA contains values outside [0,3]") dplyr::case_when(DA == 3 ~ "I am very satisfied with my daily activities", DA == 2 ~ "I am satisfied with my daily activities", DA == 1 ~ "I am dissatisfied with my daily activities", DA == 0 ~ "I am very dissatisfied with my daily activities", TRUE ~ NA_character_) } else { NA_character_ }, PH_s = if ("PH" %in% colnames(scores)) { if (any(PH < 0 | PH > 3, na.rm = TRUE)) stop("Error: PH contains values outside [0,3]") dplyr::case_when(PH == 3 ~ "I have no physical health problems", PH == 2 ~ "I have some physical health problems", PH == 1 ~ "I have many physical health problems", PH == 0 ~ "I have a great many physical health problems", TRUE ~ NA_character_) } else { NA_character_ }, FU_s = if ("FU" %in% colnames(scores)) { if (any(FU < 0 | FU > 3, na.rm = TRUE)) stop("Error: FU contains values outside [0,3]") dplyr::case_when(FU == 3 ~ "I am very optimistic about my future", FU == 2 ~ "I am optimistic about my future", FU == 1 ~ "I am gloomy about my future", FU == 0 ~ "I am very gloomy about my future", TRUE ~ NA_character_) } else { NA_character_ })`: i In argument: `SI_s = if (...) NULL`. Caused by error: ! object 'na.rm' not found Backtrace: ▆ 1. ├─testthat::expect_warning(...) at test-mhqol_scores_to_states.R:45:3 2. │ └─testthat:::expect_condition_matching(...) 3. │ └─testthat:::quasi_capture(...) 4. │ ├─testthat (local) .capture(...) 5. │ │ └─base::withCallingHandlers(...) 6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo)) 7. ├─mhqol::mhqol_scores_to_states(...) 8. │ ├─dplyr::mutate(...) 9. │ └─dplyr:::mutate.data.frame(...) 10. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by) 11. │ ├─base::withCallingHandlers(...) 12. │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns) 13. │ └─mask$eval_all_mutate(quo) 14. │ └─dplyr (local) eval() 15. └─base::.handleSimpleError(...) 16. └─dplyr (local) h(simpleError(msg, call)) 17. └─rlang::abort(message, class = error_class, parent = parent, call = error_call) ── Error ('test-mhqol_scores_to_states.R:56:3'): Test whether when retain_old_variables = TRUE, the function also returns the original variables in the data ── Error in `dplyr::mutate(scores, SI_s = if ("SI" %in% colnames(scores)) { if (any(SI < 0 | SI > 3, na.rm == TRUE)) stop("Error: SI contains values outside [0,3]") dplyr::case_when(SI == 3 ~ "I think very positively about myself", SI == 2 ~ "I think positively about myself", SI == 1 ~ "I think negatively about myself", SI == 0 ~ "I think very negatively about myself", TRUE ~ NA_character_) } else { NA_character_ }, IN_s = if ("IN" %in% colnames(scores)) { if (any(IN < 0 | IN > 3, na.rm = TRUE)) stop("Error: IN contains values outside [0,3]") dplyr::case_when(IN == 3 ~ "I am very satisfied with my level of independence", IN == 2 ~ "I am satisfied with my level of independence", IN == 1 ~ "I am dissatisfied with my level of independence", IN == 0 ~ "I am very dissatisfied with my level of independence", TRUE ~ NA_character_) } else { NA_character_ }, MO_s = if ("MO" %in% colnames(scores)) { if (any(MO < 0 | MO > 3, na.rm = TRUE)) stop("Error: MO contains values outside [0,3]") dplyr::case_when(MO == 3 ~ "I do not feel anxious, gloomy, or depressed", MO == 2 ~ "I feel a little anxious, gloomy, or depressed", MO == 1 ~ "I feel anxious, gloomy, or depressed", MO == 0 ~ "I feel very anxious, gloomy, or depressed", TRUE ~ NA_character_) } else { NA_character_ }, RE_s = if ("RE" %in% colnames(scores)) { if (any(RE < 0 | RE > 3, na.rm = TRUE)) stop("Error: RE contains values outside [0,3]") dplyr::case_when(RE == 3 ~ "I am very satisfied with my relationships", RE == 2 ~ "I am satisfied with my relationships", RE == 1 ~ "I am dissatisfied with my relationships", RE == 0 ~ "I am very dissatisfied with my relationships", TRUE ~ NA_character_) } else { NA_character_ }, DA_s = if ("DA" %in% colnames(scores)) { if (any(DA < 0 | DA > 3, na.rm = TRUE)) stop("Error: DA contains values outside [0,3]") dplyr::case_when(DA == 3 ~ "I am very satisfied with my daily activities", DA == 2 ~ "I am satisfied with my daily activities", DA == 1 ~ "I am dissatisfied with my daily activities", DA == 0 ~ "I am very dissatisfied with my daily activities", TRUE ~ NA_character_) } else { NA_character_ }, PH_s = if ("PH" %in% colnames(scores)) { if (any(PH < 0 | PH > 3, na.rm = TRUE)) stop("Error: PH contains values outside [0,3]") dplyr::case_when(PH == 3 ~ "I have no physical health problems", PH == 2 ~ "I have some physical health problems", PH == 1 ~ "I have many physical health problems", PH == 0 ~ "I have a great many physical health problems", TRUE ~ NA_character_) } else { NA_character_ }, FU_s = if ("FU" %in% colnames(scores)) { if (any(FU < 0 | FU > 3, na.rm = TRUE)) stop("Error: FU contains values outside [0,3]") dplyr::case_when(FU == 3 ~ "I am very optimistic about my future", FU == 2 ~ "I am optimistic about my future", FU == 1 ~ "I am gloomy about my future", FU == 0 ~ "I am very gloomy about my future", TRUE ~ NA_character_) } else { NA_character_ })`: i In argument: `SI_s = if (...) NULL`. Caused by error: ! object 'na.rm' not found Backtrace: ▆ 1. ├─mhqol::mhqol_scores_to_states(...) at test-mhqol_scores_to_states.R:56:3 2. │ ├─dplyr::mutate(...) 3. │ └─dplyr:::mutate.data.frame(...) 4. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by) 5. │ ├─base::withCallingHandlers(...) 6. │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns) 7. │ └─mask$eval_all_mutate(quo) 8. │ └─dplyr (local) eval() 9. └─base::.handleSimpleError(...) 10. └─dplyr (local) h(simpleError(msg, call)) 11. └─rlang::abort(message, class = error_class, parent = parent, call = error_call) ── Error ('test-mhqol_scores_to_states.R:72:3'): Test whether when retain_old_variables = FALSE, the function does not return the original variables in the data ── Error in `dplyr::mutate(scores, SI_s = if ("SI" %in% colnames(scores)) { if (any(SI < 0 | SI > 3, na.rm == TRUE)) stop("Error: SI contains values outside [0,3]") dplyr::case_when(SI == 3 ~ "I think very positively about myself", SI == 2 ~ "I think positively about myself", SI == 1 ~ "I think negatively about myself", SI == 0 ~ "I think very negatively about myself", TRUE ~ NA_character_) } else { NA_character_ }, IN_s = if ("IN" %in% colnames(scores)) { if (any(IN < 0 | IN > 3, na.rm = TRUE)) stop("Error: IN contains values outside [0,3]") dplyr::case_when(IN == 3 ~ "I am very satisfied with my level of independence", IN == 2 ~ "I am satisfied with my level of independence", IN == 1 ~ "I am dissatisfied with my level of independence", IN == 0 ~ "I am very dissatisfied with my level of independence", TRUE ~ NA_character_) } else { NA_character_ }, MO_s = if ("MO" %in% colnames(scores)) { if (any(MO < 0 | MO > 3, na.rm = TRUE)) stop("Error: MO contains values outside [0,3]") dplyr::case_when(MO == 3 ~ "I do not feel anxious, gloomy, or depressed", MO == 2 ~ "I feel a little anxious, gloomy, or depressed", MO == 1 ~ "I feel anxious, gloomy, or depressed", MO == 0 ~ "I feel very anxious, gloomy, or depressed", TRUE ~ NA_character_) } else { NA_character_ }, RE_s = if ("RE" %in% colnames(scores)) { if (any(RE < 0 | RE > 3, na.rm = TRUE)) stop("Error: RE contains values outside [0,3]") dplyr::case_when(RE == 3 ~ "I am very satisfied with my relationships", RE == 2 ~ "I am satisfied with my relationships", RE == 1 ~ "I am dissatisfied with my relationships", RE == 0 ~ "I am very dissatisfied with my relationships", TRUE ~ NA_character_) } else { NA_character_ }, DA_s = if ("DA" %in% colnames(scores)) { if (any(DA < 0 | DA > 3, na.rm = TRUE)) stop("Error: DA contains values outside [0,3]") dplyr::case_when(DA == 3 ~ "I am very satisfied with my daily activities", DA == 2 ~ "I am satisfied with my daily activities", DA == 1 ~ "I am dissatisfied with my daily activities", DA == 0 ~ "I am very dissatisfied with my daily activities", TRUE ~ NA_character_) } else { NA_character_ }, PH_s = if ("PH" %in% colnames(scores)) { if (any(PH < 0 | PH > 3, na.rm = TRUE)) stop("Error: PH contains values outside [0,3]") dplyr::case_when(PH == 3 ~ "I have no physical health problems", PH == 2 ~ "I have some physical health problems", PH == 1 ~ "I have many physical health problems", PH == 0 ~ "I have a great many physical health problems", TRUE ~ NA_character_) } else { NA_character_ }, FU_s = if ("FU" %in% colnames(scores)) { if (any(FU < 0 | FU > 3, na.rm = TRUE)) stop("Error: FU contains values outside [0,3]") dplyr::case_when(FU == 3 ~ "I am very optimistic about my future", FU == 2 ~ "I am optimistic about my future", FU == 1 ~ "I am gloomy about my future", FU == 0 ~ "I am very gloomy about my future", TRUE ~ NA_character_) } else { NA_character_ })`: i In argument: `SI_s = if (...) NULL`. Caused by error: ! object 'na.rm' not found Backtrace: ▆ 1. ├─mhqol::mhqol_scores_to_states(...) at test-mhqol_scores_to_states.R:72:3 2. │ ├─dplyr::mutate(...) 3. │ └─dplyr:::mutate.data.frame(...) 4. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by) 5. │ ├─base::withCallingHandlers(...) 6. │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns) 7. │ └─mask$eval_all_mutate(quo) 8. │ └─dplyr (local) eval() 9. └─base::.handleSimpleError(...) 10. └─dplyr (local) h(simpleError(msg, call)) 11. └─rlang::abort(message, class = error_class, parent = parent, call = error_call) ── Error ('test-mhqol_scores_to_states.R:87:3'): Test whether the function returns the correct states for the scores ── Error in `dplyr::mutate(scores, SI_s = if ("SI" %in% colnames(scores)) { if (any(SI < 0 | SI > 3, na.rm == TRUE)) stop("Error: SI contains values outside [0,3]") dplyr::case_when(SI == 3 ~ "I think very positively about myself", SI == 2 ~ "I think positively about myself", SI == 1 ~ "I think negatively about myself", SI == 0 ~ "I think very negatively about myself", TRUE ~ NA_character_) } else { NA_character_ }, IN_s = if ("IN" %in% colnames(scores)) { if (any(IN < 0 | IN > 3, na.rm = TRUE)) stop("Error: IN contains values outside [0,3]") dplyr::case_when(IN == 3 ~ "I am very satisfied with my level of independence", IN == 2 ~ "I am satisfied with my level of independence", IN == 1 ~ "I am dissatisfied with my level of independence", IN == 0 ~ "I am very dissatisfied with my level of independence", TRUE ~ NA_character_) } else { NA_character_ }, MO_s = if ("MO" %in% colnames(scores)) { if (any(MO < 0 | MO > 3, na.rm = TRUE)) stop("Error: MO contains values outside [0,3]") dplyr::case_when(MO == 3 ~ "I do not feel anxious, gloomy, or depressed", MO == 2 ~ "I feel a little anxious, gloomy, or depressed", MO == 1 ~ "I feel anxious, gloomy, or depressed", MO == 0 ~ "I feel very anxious, gloomy, or depressed", TRUE ~ NA_character_) } else { NA_character_ }, RE_s = if ("RE" %in% colnames(scores)) { if (any(RE < 0 | RE > 3, na.rm = TRUE)) stop("Error: RE contains values outside [0,3]") dplyr::case_when(RE == 3 ~ "I am very satisfied with my relationships", RE == 2 ~ "I am satisfied with my relationships", RE == 1 ~ "I am dissatisfied with my relationships", RE == 0 ~ "I am very dissatisfied with my relationships", TRUE ~ NA_character_) } else { NA_character_ }, DA_s = if ("DA" %in% colnames(scores)) { if (any(DA < 0 | DA > 3, na.rm = TRUE)) stop("Error: DA contains values outside [0,3]") dplyr::case_when(DA == 3 ~ "I am very satisfied with my daily activities", DA == 2 ~ "I am satisfied with my daily activities", DA == 1 ~ "I am dissatisfied with my daily activities", DA == 0 ~ "I am very dissatisfied with my daily activities", TRUE ~ NA_character_) } else { NA_character_ }, PH_s = if ("PH" %in% colnames(scores)) { if (any(PH < 0 | PH > 3, na.rm = TRUE)) stop("Error: PH contains values outside [0,3]") dplyr::case_when(PH == 3 ~ "I have no physical health problems", PH == 2 ~ "I have some physical health problems", PH == 1 ~ "I have many physical health problems", PH == 0 ~ "I have a great many physical health problems", TRUE ~ NA_character_) } else { NA_character_ }, FU_s = if ("FU" %in% colnames(scores)) { if (any(FU < 0 | FU > 3, na.rm = TRUE)) stop("Error: FU contains values outside [0,3]") dplyr::case_when(FU == 3 ~ "I am very optimistic about my future", FU == 2 ~ "I am optimistic about my future", FU == 1 ~ "I am gloomy about my future", FU == 0 ~ "I am very gloomy about my future", TRUE ~ NA_character_) } else { NA_character_ })`: i In argument: `SI_s = if (...) NULL`. Caused by error: ! object 'na.rm' not found Backtrace: ▆ 1. ├─mhqol::mhqol_scores_to_states(...) at test-mhqol_scores_to_states.R:87:3 2. │ ├─dplyr::mutate(...) 3. │ └─dplyr:::mutate.data.frame(...) 4. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by) 5. │ ├─base::withCallingHandlers(...) 6. │ └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns) 7. │ └─mask$eval_all_mutate(quo) 8. │ └─dplyr (local) eval() 9. └─base::.handleSimpleError(...) 10. └─dplyr (local) h(simpleError(msg, call)) 11. └─rlang::abort(message, class = error_class, parent = parent, call = error_call) [ FAIL 5 | WARN 14 | SKIP 0 | PASS 86 ] Error: Test failures Execution halted