r-causal / tipr

An R package for conducting sensitivity analyses for unmeasured confounders
https://r-causal.github.io/tipr/
Other
33 stars 2 forks source link

Overhaul messaging and erroring #15

Closed malcolmbarrett closed 1 year ago

malcolmbarrett commented 1 year ago

Closes #14

This PR also updates to use cli and rlang for errors, which were already implicit dependencies via purrr.

library(tipr)
tip_coef(1)
#> Error in `check_arguments()` at tipr/R/tip_coef.R:41:2:
#> ✖ `tip_coef()` requires at least 1 of the following arguments specified:
#> • `exposure_confounder_effect`
#> • `confounder_outcome_effect`

#> Backtrace:
#>     ▆
#>  1. └─tipr::tip_coef(1)
#>  2.   └─tipr:::check_arguments("tip_coef()", exposure_confounder_effect, confounder_outcome_effect) at tipr/R/tip_coef.R:41:2
#>  3.     └─tipr:::stop_cli(...) at tipr/R/utils.R:55:4
#>  4.       └─cli::cli_abort(message, ..., .envir = .envir) at tipr/R/utils.R:12:2
#>  5.         └─rlang::abort(...)

Created on 2022-11-25 with reprex v2.0.2

LucyMcGowan commented 1 year ago

You’re the best!