From b899cdbf2963536cb3623a49e02696fb9afdf96b Mon Sep 17 00:00:00 2001 From: Adam Howes Date: Fri, 15 Nov 2024 11:16:28 +0000 Subject: [PATCH] Issue #381: Rename linelist argument to data (#437) --- R/simulate.R | 8 ++++---- man/simulate_secondary.Rd | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/R/simulate.R b/R/simulate.R index 25994a5c2..7ef51b578 100644 --- a/R/simulate.R +++ b/R/simulate.R @@ -116,19 +116,19 @@ simulate_gillespie <- function(r = 0.2, #' distribution. The input dataset should have the primary event times in a #' column named `ptime`. #' -#' @param linelist A data frame with the primary event times. +#' @param data A data frame with the primary event times. #' @param dist The delay distribution to be used. Defaults to [rlnorm()]. #' @param ... Arguments to be passed to the delay distribution function. #' -#' @return A `data.frame` that augments `linelist` with two new columns: `delay` +#' @return A `data.frame` that augments `data` with two new columns: `delay` #' (secondary event latency) and `stime` (the time of the secondary event). #' #' @family simulate #' @autoglobal #' @importFrom dplyr mutate #' @export -simulate_secondary <- function(linelist, dist = rlnorm, ...) { - linelist |> +simulate_secondary <- function(data, dist = rlnorm, ...) { + data |> mutate( delay = dist(dplyr::n(), ...), stime = .data$ptime + .data$delay diff --git a/man/simulate_secondary.Rd b/man/simulate_secondary.Rd index e0e097972..da84f0168 100644 --- a/man/simulate_secondary.Rd +++ b/man/simulate_secondary.Rd @@ -4,17 +4,17 @@ \alias{simulate_secondary} \title{Simulate secondary events based on a delay distribution} \usage{ -simulate_secondary(linelist, dist = rlnorm, ...) +simulate_secondary(data, dist = rlnorm, ...) } \arguments{ -\item{linelist}{A data frame with the primary event times.} +\item{data}{A data frame with the primary event times.} \item{dist}{The delay distribution to be used. Defaults to \code{\link[=rlnorm]{rlnorm()}}.} \item{...}{Arguments to be passed to the delay distribution function.} } \value{ -A \code{data.frame} that augments \code{linelist} with two new columns: \code{delay} +A \code{data.frame} that augments \code{data} with two new columns: \code{delay} (secondary event latency) and \code{stime} (the time of the secondary event). } \description{