@@ -77,21 +77,18 @@ make_strata <- function(x, breaks = 4, nunique = 5, pool = .1, depth = 20) {
7777
7878 # # This should really be based on some combo of rate and number.
7979 if (all(pcts < pool )) {
80- rlang :: warn (c(
80+ cli_warn (c(
8181 " Too little data to stratify." ,
82- " Resampling will be unstratified."
82+ " * " = " Resampling will be unstratified."
8383 ))
8484 return (factor (rep(" strata1" , n )))
8585 }
8686
8787 if (pool < default_pool & any(pcts < default_pool )) {
88- rlang :: warn(c(
89- paste0(
90- " Stratifying groups that make up " ,
91- round(100 * pool ), " % of the data may be " ,
92- " statistically risky."
93- ),
94- " Consider increasing `pool` to at least 0.1"
88+ cli_warn(c(
89+ " Stratifying groups that make up {round(100 * pool)}% of the data may
90+ be statistically risky." ,
91+ i = " Consider increasing {.arg pool} to at least 0.1."
9592 ))
9693 }
9794
@@ -104,25 +101,23 @@ make_strata <- function(x, breaks = 4, nunique = 5, pool = .1, depth = 20) {
104101 out <- factor (as.character(x ))
105102 } else {
106103 if (breaks < 2 ) {
107- rlang :: warn (c(
108- " The bins specified by ` breaks` must be >=2." ,
109- " Resampling will be unstratified."
104+ cli_warn (c(
105+ " The bins specified by {.arg breaks} must be >=2." ,
106+ " * " = " Resampling will be unstratified."
110107 ))
111108 return (factor (rep(" strata1" , n )))
112109 } else if (floor(n / breaks ) < depth ) {
113- rlang :: warn(c(
114- paste0(
115- " The number of observations in each quantile is " ,
116- " below the recommended threshold of " , depth , " ."
117- ),
118- paste0(" Stratification will use " , floor(n / depth ), " breaks instead." )
110+ cli_warn(c(
111+ " The number of observations in each quantile is below the recommended
112+ threshold of {depth}." ,
113+ " *" = " Stratification will use {floor(n / depth)} breaks instead."
119114 ))
120115 }
121116 breaks <- min(breaks , floor(n / depth ))
122117 if (breaks < 2 ) {
123- rlang :: warn (c(
118+ cli_warn (c(
124119 " Too little data to stratify." ,
125- " Resampling will be unstratified."
120+ " * " = " Resampling will be unstratified."
126121 ))
127122 return (factor (rep(" strata1" , n )))
128123 }
0 commit comments