File tree Expand file tree Collapse file tree 2 files changed +39
-6
lines changed Expand file tree Collapse file tree 2 files changed +39
-6
lines changed Original file line number Diff line number Diff line change 132132 )
133133 }
134134 if (! identical(eval_time , eval_time_0 )) {
135- diffs <- setdiff(eval_time_0 , eval_time )
136- cli :: cli_warn(" There {?was/were} {length(diffs)} inappropriate evaluation
137- time point{?s} that {?was/were} removed." , call = NULL )
135+ diffs <- length(eval_time_0 ) - length(eval_time )
138136
137+ offenders <- character ()
138+
139+ n_na <- sum(is.na(eval_time_0 ))
140+ if (n_na > 0 ) {
141+ offenders <- c(offenders , " *" = " {n_na} missing value{?s}." )
142+ }
143+
144+ n_inf <- sum(is.infinite(eval_time_0 ))
145+ if (n_inf > 0 ) {
146+ offenders <- c(offenders , " *" = " {n_inf} infinite value{?s}." )
147+ }
148+
149+ n_neg <- sum(eval_time_0 < 0 , na.rm = TRUE )
150+ if (n_neg > 0 ) {
151+ offenders <- c(offenders , " *" = " {n_neg} negative value{?s}." )
152+ }
153+
154+ n_dup <- diffs - n_na - n_inf - n_neg
155+ if (n_dup > 0 ) {
156+ offenders <- c(offenders , " *" = " {n_dup} duplicate value{?s}." )
157+ }
158+
159+ cli :: cli_warn(
160+ c(
161+ " There {?was/were} {diffs} inappropriate evaluation time \\
162+ point{?s} that {?was/were} removed. They were:" ,
163+ offenders
164+ ),
165+ call = NULL
166+ )
139167 }
140168 eval_time
141169}
Original file line number Diff line number Diff line change 44 parsnip:::.filter_eval_time(times_duplicated)
55 Condition
66 Warning:
7- There were 0 inappropriate evaluation time points that were removed.
7+ There were 11 inappropriate evaluation time points that were removed. They were:
8+ * 11 duplicate values.
89 Output
910 [1] 0 1 2 3 4 5 6 7 8 9 10
1011
2223 parsnip:::.filter_eval_time(times_remove_plural)
2324 Condition
2425 Warning:
25- There were 3 inappropriate evaluation time points that were removed.
26+ There were 3 inappropriate evaluation time points that were removed. They were:
27+ * 1 missing value.
28+ * 1 infinite value.
29+ * 1 negative value.
2630 Output
2731 [1] 0 1 2 3 4 5 6 7 8 9 10
2832
3236 parsnip:::.filter_eval_time(times_remove_singular)
3337 Condition
3438 Warning:
35- There was 1 inappropriate evaluation time point that was removed.
39+ There was 1 inappropriate evaluation time point that was removed. They were:
40+ * 1 negative value.
3641 Output
3742 [1] 0 1 2 3 4 5 6 7 8 9 10
3843
You can’t perform that action at this time.
0 commit comments