Skip to content

Commit

Permalink
Throw an error when the time column does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam committed Sep 20, 2023
1 parent 872c6e1 commit a9f4b00
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/epichains.R
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ aggregate.epichains <- function(x,
grouping_var <- match.arg(grouping_var)

out <- if (grouping_var == "time") {
if (is.null(x$time)) {
stop(
"Object must have a time column. ",
"To simulate time, specify `serials_dist` ",
"in the `simulate_tree()` setup."
)
}
# Count the number of cases per generation
stats::aggregate(
list(cases = x$sim_id),
Expand Down

0 comments on commit a9f4b00

Please sign in to comment.