Skip to content

Commit

Permalink
Style code
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam committed Nov 10, 2023
1 parent 5ddef94 commit 8693215
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions R/simulate.r
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,19 @@ simulate_tree <- function(nchains, statistic = c("size", "length"),
roffspring_name <- paste0("r", offspring_dist)
check_offspring_func_valid(roffspring_name)

checkmate::assert_numeric(stat_max, lower = 0)
check_serial_valid(serials_dist)
checkmate::assert_numeric(t0, lower = 0, finite = TRUE)
checkmate::assert_number(tf, lower = 0, finite = TRUE)
checkmate::assert_number(
stat_max, lower = 0
)

if (!missing(serials_dist)) {
check_serial_valid(serials_dist)
}
checkmate::assert_numeric(
t0, lower = 0, finite = TRUE
)
checkmate::assert_number(
tf, lower = 0
)

# Gather offspring distribution parameters
pars <- list(...)
Expand Down Expand Up @@ -295,7 +304,9 @@ simulate_summary <- function(nchains, statistic = c("size", "length"),
roffspring_name <- paste0("r", offspring_dist)
check_offspring_func_valid(roffspring_name)

checkmate::assert_numeric(stat_max, lower = 0)
checkmate::assert_number(
stat_max, lower = 0
)

# Gather offspring distribution parameters
pars <- list(...)
Expand Down Expand Up @@ -425,12 +436,22 @@ simulate_tree_from_pop <- function(pop,
offspring_dist <- match.arg(offspring_dist)

# Input checking
checkmate::assert_number(pop, lower = 1, finite = TRUE)
checkmate::assert_number(
pop, lower = 1, finite = TRUE
)
checkmate::assert_string(offspring_dist)
checkmate::assert_function(serials_dist, nargs = 1)
checkmate::assert_number(initial_immune, lower = 0, upper = pop - 1)
checkmate::assert_number(t0, lower = 0, finite = TRUE)
checkmate::assert_number(tf, lower = 0, finite = TRUE)
if (!missing(serials_dist)) {
check_serial_valid(serials_dist)
}
checkmate::assert_number(
initial_immune, lower = 0, upper = pop - 1
)
checkmate::assert_number(
t0, lower = 0, finite = TRUE
)
checkmate::assert_number(
tf, lower = 0
)

# Gather offspring distribution parameters
pars <- list(...)
Expand Down

0 comments on commit 8693215

Please sign in to comment.