From 1ef29856afc05d06130477a7dc4247e307e6a0fb Mon Sep 17 00:00:00 2001 From: James Azam Date: Tue, 16 Jan 2024 11:33:10 +0000 Subject: [PATCH] Match choice arguments before checking them --- R/simulate.r | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/simulate.r b/R/simulate.r index 1fd312bb..2c20ab74 100644 --- a/R/simulate.r +++ b/R/simulate.r @@ -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") @@ -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")