Skip to content

Commit

Permalink
Match choice arguments before checking them
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam committed Jan 16, 2024
1 parent d79a666 commit 1ef2985
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/simulate.r
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ simulate_summary <- function(ntrees, statistic = c("size", "length"),
stat_max = Inf, ...) {
# Input checking
checkmate::assert_count(ntrees, positive = TRUE)
statistic <- match.arg(statistic)
checkmate::assert_choice(
statistic,
choices = c("size", "length")
Expand Down Expand Up @@ -415,6 +416,7 @@ simulate_tree_from_pop <- function(pop,
checkmate::assert_number(
pop, lower = 1, finite = TRUE
)
offspring_dist <- match.arg(offspring_dist)
checkmate::assert_choice(
offspring_dist,
choices = c("pois", "nbinom")
Expand Down

0 comments on commit 1ef2985

Please sign in to comment.