impact-initiatives-hppu / humind

Compose MSNA Indicators
https://impact-initiatives-hppu.github.io/humind/
MIT License
2 stars 2 forks source link

[Error] 2 6 | add_dummy_from_set: add_dummy_from_set handles empty set #93

Closed github-actions[bot] closed 2 months ago

github-actions[bot] commented 3 months ago

Context: 2 6 | add_dummy_from_set Type: Error Description: add_dummy_from_set handles empty set Tested Function: 2 6 | add_dummy_from_set Test File: 'test-add_dummy_from_set.R Failed at Line: 37

Details: <dplyr:::mutate_error/rlang_error/error/condition> Error in dplyr::mutate(df,:=("{dummy_name}", dplyr::case_when(is.na({ { col } }) ~ NA_real_, stringr::str_detect({ { col } }, pattern) ~ 1, !stringr::str_detect({ { col } }, pattern) ~ 0, .default = NA_real_))): ℹ In argument: dummy_empty = dplyr::case_when(...). Caused by error in dplyr::case_when(): ! Failed to evaluate the left-hand side of formula 2. Caused by error in stringr::str_detect(): ! pattern can't be the empty string (""). Backtrace: ▆

  1. ├─humind::add_dummy_from_set(df, text_col, "dummy_empty", c()) at test-add_dummy_from_set.R:37: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. ├─dplyr::case_when(...)
    1. │ └─dplyr:::case_formula_evaluate(...)
    2. │ ├─base::withCallingHandlers(...)
    3. │ └─rlang::eval_tidy(pair$lhs, env = default_env)
    4. ├─stringr::str_detect(text_col, pattern)
    5. │ └─stringr:::no_empty()
    6. │ └─cli::cli_abort(...)
    7. │ └─rlang::abort(...)
    8. │ └─rlang:::signal_abort(cnd, .file)
    9. │ └─base::signalCondition(cnd)
    10. ├─dplyr (local) <fn>(<rlng_rrr>)
    11. │ └─rlang::abort(message, parent = cnd, call = error_call)
    12. │ └─rlang:::signal_abort(cnd, .file)
    13. │ └─base::signalCondition(cnd)
    14. └─dplyr (local) <fn>(<rlng_rrr>)
    15. └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
gnoblet commented 3 months ago

@lanawwas add_dummy_from_set() to be removed

github-actions[bot] commented 3 months ago

Related open issues for the same function:

94

github-actions[bot] commented 2 months ago

Related open issues for the same function:

94

github-actions[bot] commented 2 months ago

Related open issues for the same function:

94

github-actions[bot] commented 2 months ago

Related open issues for the same function:

94

github-actions[bot] commented 2 months ago

Related open issues for the same function:

94

github-actions[bot] commented 2 months ago

Related open issues for the same function:

94

github-actions[bot] commented 2 months ago

Related open issues for the same function:

94