Skip to content

Commit

Permalink
switching to cli
Browse files Browse the repository at this point in the history
  • Loading branch information
d-morrison committed Jul 18, 2024
1 parent 3fa96ec commit dff4262
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions R/count_strata.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ count_strata <- function(data, strata_varnames) {
)

if (nrow(uneven_counts) > 0) {
warning("The number of observations in `data` varies between antigen isotypes, for at least one stratum. Sample size for each stratum will be calculated as the minimum number of observations across all antigen isotypes.\n")

c(
"The number of observations in `data` varies between antigen
isotypes, for at least one stratum.",
"Sample size for each stratum will be calculated as
the minimum number of observations across all antigen isotypes."
) %>%
cli::cli_warn(class = "incomplete-obs")
}

to_return <-
Expand All @@ -29,7 +36,12 @@ count_strata <- function(data, strata_varnames) {
}

if (any(duplicated(to_return$Stratum))) {
stop("The data contain multiple strata with the same value of the `Stratum` variable. Please disambiguate.")
c(
"The data contain multiple strata with the same value
of the {.var Stratum} variable.",
"Please disambiguate."
) %>%
cli::cli_abort()

Check warning on line 44 in R/count_strata.R

View check run for this annotation

Codecov / codecov/patch

R/count_strata.R#L39-L44

Added lines #L39 - L44 were not covered by tests
}

attr(to_return, "strata_vars") <- strata_varnames
Expand Down

0 comments on commit dff4262

Please sign in to comment.