Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not error when hosp_death_risk is NA without hospitalisation #144

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions R/checkers.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@
))
}
if (!rlang::is_lgl_na(onset_to_death_eval)) {
if (rlang::is_lgl_na(hosp_death_risk)) {
if (rlang::is_lgl_na(hosp_death_risk) && !rlang::is_lgl_na(hosp_risk)) {
msg <- c(msg, paste(
"hosp_death_risk is set to NA but onset_to_death is specified \n",
"set hosp_death_risk to numeric value"
"hosp_death_risk is set to NA but hosp_risk and onset_to_death is",
"specified \n set hosp_death_risk to numeric value"
))
}
if (rlang::is_lgl_na(non_hosp_death_risk)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-sim_linelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ test_that("sim_linelist fails when onset-to-event are given by risk is NA", {
onset_to_death = onset_to_death,
hosp_death_risk = NA
),
regexp = "(hosp_death_risk is set to NA but onset_to_death is specified)"
regexp = "(hosp_death_risk is set to NA but hosp_risk and onset_to_death)"
)
expect_error(
sim_linelist(
Expand Down
Loading