Skip to content

Commit

Permalink
Add error messages to switch alternatives
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam committed Feb 6, 2024
1 parent d3e8d85 commit ed3b5bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
)
)
}
Expand All @@ -26,7 +27,8 @@
switch(
chain_statistic,
size = rbinom_size,
length = rgen_length
length = rgen_length,
stop("chain_statistic must be 'size' or 'length'")
)
)
}
Expand Down

0 comments on commit ed3b5bd

Please sign in to comment.