From ed3b5bd243d81f2e60c0b5979ad3fae6b9f2d82e Mon Sep 17 00:00:00 2001 From: jamesaazam Date: Tue, 6 Feb 2024 13:47:34 +0000 Subject: [PATCH] Add error messages to switch alternatives --- R/helpers.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/helpers.R b/R/helpers.R index 1fa3a5f4..18bb9129 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -10,7 +10,8 @@ switch( stat_type, size = stat_latest + n_offspring, - length = stat_latest + pmin(1, n_offspring) + length = stat_latest + pmin(1, n_offspring), + stop("stat_type must be 'size' or 'length'") ) ) } @@ -26,7 +27,8 @@ switch( chain_statistic, size = rbinom_size, - length = rgen_length + length = rgen_length, + stop("chain_statistic must be 'size' or 'length'") ) ) }