Skip to content

Commit

Permalink
merge .add_date and .add_info documentation and rename to .add_cols
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlambert committed May 31, 2024
1 parent eb88c6c commit f00d8aa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 66 deletions.
35 changes: 8 additions & 27 deletions R/add_cols.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#' Add event date as column to infectious history `<data.frame>`
#' Add line list event dates and case information as columns to infectious
#' history `<data.frame>`
#'
#' @description These `.add_*()` functions add columns to the `<data.frame>`
#' output by [.sim_network_bp()]. The `<data.frame>` supplied to `.data` will
Expand All @@ -20,7 +21,7 @@
#' given in the `distribution` argument.
#' @inheritParams sim_linelist
#'
#' @name .add_date
#' @name .add_cols
#'
#' @return A `<data.frame>` with one more column than input into `.data`.
#' Unless the column heading is already present in which the data is
Expand All @@ -29,7 +30,7 @@
#'
NULL

#' @name .add_date
#' @name .add_cols
.add_date_contact <- function(.data,
contact_type = c("first", "last"),
distribution = c("pois", "geom"),
Expand Down Expand Up @@ -86,7 +87,7 @@ NULL
.data
}

#' @name .add_date
#' @name .add_cols
.add_hospitalisation <- function(.data,
onset_to_hosp,
hosp_risk) {
Expand Down Expand Up @@ -126,7 +127,7 @@ NULL
.data
}

#' @name .add_date
#' @name .add_cols
.add_outcome <- function(.data,
onset_to_death,
onset_to_recovery,
Expand Down Expand Up @@ -214,27 +215,7 @@ NULL
.data
}

#' Add line list information as column to infectious history `<data.frame>`
#'
#' @param .data A `<data.frame>` containing the infectious history from a
#' branching process simulation
#' @param distribution A `character` with the name of the distribution,
#' following the base R convention for distribution naming (e.g. Poisson
#' is `pois`).
#' @param ... [dots] Extra arguments to be passed to the distribution function
#' given in the `distribution` argument.
#' @inheritParams sim_linelist
#'
#' @name .add_info
#'
#' @return A `<data.frame>` with one more column than input into `.data`.
#' Unless the column heading is already present in which the data is
#' overwritten.
#' @keywords internal
#'
NULL

#' @name .add_info
#' @name .add_cols
.add_names <- function(.data, anonymise = FALSE) {
.data$case_name <- .sample_names(.data = .data)
if (anonymise) {
Expand All @@ -256,7 +237,7 @@ NULL
.data
}

#' @name .add_info
#' @name .add_cols
.add_ct <- function(.data, distribution = c("norm", "lnorm"), ...) {
distribution <- match.arg(distribution)

Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' the `.sample_names()` function will need to loop until it has enough
#' unique names.
#'
#' @inheritParams .add_date
#' @inheritParams .add_cols
#' @param buffer_factor A single `numeric` determining the level of
#' oversampling (or buffer) when creating a vector of unique names from
#' [randomNames()].
Expand Down
16 changes: 13 additions & 3 deletions man/dot-add_date.Rd → man/dot-add_cols.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 0 additions & 35 deletions man/dot-add_info.Rd

This file was deleted.

0 comments on commit f00d8aa

Please sign in to comment.