Skip to content

Commit ead2f90

Browse files
committed
chore(docstrings): change from `` to \code{} in docstrings, and add full stops
1 parent 528173c commit ead2f90

File tree

8 files changed

+39
-24
lines changed

8 files changed

+39
-24
lines changed

R/add_patient_generator.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#' one of: "stroke", "tia", "neuro", or "other". Determines which arrival rate
1515
#' parameter is used.
1616
#' @param param Nested list containing simulation parameters. Must have
17-
#' structure `param$<unit>_arrivals$<patient_type>` containing numeric
18-
#' arrival intervals (e.g., `param$asu_arrivals$stroke = 10`).
17+
#' structure \code{param$<unit>_arrivals$<patient_type>} containing numeric
18+
#' arrival intervals (e.g., \code{param$asu_arrivals$stroke = 10}).
1919
#'
2020
#' @importFrom simmer add_generator
2121
#' @importFrom stats rexp

R/create_rehab_trajectory.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
#' Create rehab patient trajectory
1+
#' Create rehab patient trajectory.
22
#'
33
#' @param patient_type Character string specifying patient category. Must be
44
#' one of: "stroke", "tia", "neuro", or "other". Determines which arrival rate
55
#' parameter is used.
66
#' @param param Nested list containing simulation parameters. Must have
7-
#' structure `param$rehab_routing$<patient_type>` containing the probability of
8-
#' routing to each destination (e.g.`param$rehab_routing$stroke$esd = 0.40`).
7+
#' structure \code{param$rehab_routing$<patient_type>} containing the
8+
#' probability of routing to each destination (e.g.
9+
#' \code{param$rehab_routing$stroke$esd = 0.40}).
910
#'
1011
#' @importFrom simmer trajectory
1112
#'

R/model.R

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' @param run_number Integer representing index of current simulation run.
44
#' @param param Named list of model parameters.
55
#' @param set_seed Whether to set seed within the model function (which we
6-
#' may not wish to do if being set elsewhere - such as done in runner()).
6+
#' may not wish to do if being set elsewhere - such as done in \code{runner()}).
77
#' Default is TRUE.
88
#'
99
#' @importFrom simmer get_attribute get_mon_arrivals get_mon_resources
@@ -19,19 +19,30 @@ model <- function(run_number, param, set_seed = TRUE) {
1919
set.seed(run_number)
2020
}
2121

22+
# Transform LOS parameters to lognormal scale
23+
param[["asu_los_lnorm"]] <- transform_to_lnorm(param[["asu_los"]])
24+
param[["rehab_los_lnorm"]] <- transform_to_lnorm(param[["rehab_los"]])
25+
2226
# Create simmer environment
2327
env <- simmer("simulation", verbose = TRUE)
2428

2529
# Add ASU and rehab direct admission patient generators
2630
for (unit in c("asu", "rehab")) {
2731
for (patient_type in names(param[[paste0(unit, "_arrivals")]])) {
32+
33+
# Create patient trajectory
34+
traj <- if (unit == "asu") {
35+
create_asu_trajectory(
36+
env = env, patient_type = patient_type, param = param
37+
)
38+
} else {
39+
create_rehab_trajectory(patient_type, param)
40+
}
41+
42+
# Add patient generator using the created trajectory
2843
env <- add_patient_generator(
2944
env = env,
30-
# Get trajectory given unit and patient type
31-
trajectory = (
32-
if (unit == "asu") create_asu_trajectory(patient_type, param)
33-
else create_rehab_trajectory(patient_type, param)
34-
),
45+
trajectory = traj,
3546
unit = unit,
3647
patient_type = patient_type,
3748
param = param

R/sample_routing.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
#' Sample a destination based on probabilities
1+
#' Sample a destination based on probabilities.
22
#'
33
#' Randomly selects a destination from a list, where each destination has an
44
#' associated probability. The destination is returned as a numeric index, as
5-
#' `simmer::set_attribute()` requires a numeric or function.
5+
#' \code{simmer::set_attribute()} requires a numeric or function.
66
#'
77
#' @param prob_list Named list. The names are destination labels (character),
88
#' and the values are their corresponding probabilities (numeric, non-negative,
99
#' sum to 1).
1010
#'
11-
#' @return An integer. The index of the selected destination within `prob_list`.
11+
#' @return An integer. The index of the selected destination within
12+
#' \code{prob_list}.
1213
#' @export
1314

1415
sample_routing <- function(prob_list) {

man/add_patient_generator.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/create_rehab_trajectory.Rd

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sample_routing.Rd

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)