Skip to content

Commit

Permalink
Fixing GHA (plot run_multipl)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Aug 29, 2023
1 parent e6502fc commit a24b042
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions R/make_saver.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,27 @@ run_multiple_get_results <- function(m) {
# Putting all together
output[[i]] <- do.call(rbind, output[[i]])

# runif
#
# runif(10, min=2, max=4)
# do.call(runif, list(10, 2, 4))
#
# rbind(output[[i]][[1]], output[[i]][[2]], ...)

class(output[[i]]) <- c("epiworld_multiple_save_i", class(output[[i]]))
# If there are no observations, then
err_msg <- tryCatch({
class(output[[i]]) <- c("epiworld_multiple_save_i", class(output[[i]]))
}, error = function(e) e
)

if (inherits(err_msg, "error")) {

warning(
"When retrieving the saved results, for the case of ",
i, ", there were no observations."
)

class(output[[i]]) <- structure(
data.frame(),
c("epiworld_multiple_save_i")
)

}

attr(output[[i]], "what") <- i


}

Expand All @@ -180,6 +191,14 @@ plot.epiworld_multiple_save <- function(x, y = NULL, ...) {
plot.epiworld_multiple_save_i <- function(x, y = NULL, ...) {

what <- attr(x, "what")

if (nrow(x) == 0) {
warning(
"When plotting the saved results, for the case of ",
what, ", there were no observations."
)
return(NULL)
}

# If it is not reproductive number, then...
if (what != "reproductive") {
Expand Down

0 comments on commit a24b042

Please sign in to comment.