Skip to content

Commit cf614e7

Browse files
committed
catch warning when all time_values missing
1 parent 313769c commit cf614e7

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

R/archive.R

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,27 @@ epi_archive =
189189
}
190190
cat("----------\n")
191191
cat(sprintf("* %-14s = %s\n", "min time value",
192-
Min(self$DT$time_value)))
192+
tryCatch({
193+
Min(self$DT$time_value)
194+
},
195+
warning = function(w) {
196+
if (w$message != "no non-missing arguments to min; returning Inf") {
197+
warning(w)
198+
}
199+
NA
200+
}
201+
)))
193202
cat(sprintf("* %-14s = %s\n", "max time value",
194-
Max(self$DT$time_value)))
203+
tryCatch({
204+
Max(self$DT$time_value)
205+
},
206+
warning = function(w) {
207+
if (w$message != "no non-missing arguments to max; returning -Inf") {
208+
warning(w)
209+
}
210+
NA
211+
}
212+
)))
195213
cat(sprintf("* %-14s = %s\n", "min version",
196214
min(self$DT$version)))
197215
cat(sprintf("* %-14s = %s\n", "max version",

0 commit comments

Comments
 (0)