Skip to content

Commit

Permalink
improved warnings about missing stratifying variables
Browse files Browse the repository at this point in the history
  • Loading branch information
d-morrison committed Nov 15, 2023
1 parent c424e47 commit 8afe5b1
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions R/warn_missing_strata.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,34 @@ warn_missing_strata = function(

if(length(missing_strata_vars) > 0)
{
warning(
dataname,
" is missing some strata variables: ",
missing_strata_vars |> paste(collapse = ", "),
"\n", dataname, " will only be stratified by: ",
present_strata_vars |> paste(collapse = ","))



if(length(present_strata_vars) > 0)
{

message =
c(
dataname,
" is missing some strata variables: ",
missing_strata_vars |> paste(collapse = ", "),
"\n", dataname, " will only be stratified by: ",
present_strata_vars |> paste(collapse = ",")
)
} else
{
message = c(
dataname,
" is missing all strata variables, and will be used unstratified.")
}

message2 = c(
"\To avoid this warning, specify the desired set of stratifying",
" variables in the `curve_strata_varnames` and `noise_strata_varnames`",
" arguments to `est.incidence.by()`"
)

warning(message, message2)
}

if(length(present_strata_vars) > 0)
Expand Down

0 comments on commit 8afe5b1

Please sign in to comment.