Skip to content

Commit

Permalink
Use autoglobal for two remaining functions (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
athowes authored Jun 20, 2024
1 parent f99654b commit 290bdfb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 16 additions & 0 deletions R/globals.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ utils::globalVariables(c(
"value", # <make_relative_to_truth>
"rel_value", # <make_relative_to_truth>
"value", # <summarise_variable>
"id", # <epidist_prepare.epidist_latent_individual>
"obs_t", # <epidist_prepare.epidist_latent_individual>
"obs_at", # <epidist_prepare.epidist_latent_individual>
"ptime_lwr", # <epidist_prepare.epidist_latent_individual>
"pwindow_upr", # <epidist_prepare.epidist_latent_individual>
"stime_lwr", # <epidist_prepare.epidist_latent_individual>
"ptime_upr", # <epidist_prepare.epidist_latent_individual>
"stime_upr", # <epidist_prepare.epidist_latent_individual>
"woverlap", # <epidist_prepare.epidist_latent_individual>
"swindow_upr", # <epidist_prepare.epidist_latent_individual>
"delay_central", # <epidist_prepare.epidist_latent_individual>
"row_id", # <epidist_prepare.epidist_latent_individual>
"woverlap", # <epidist_stancode.epidist_latent_individual>
"row_id", # <epidist_stancode.epidist_latent_individual>
"ptime_daily", # <observe_process>
Expand Down Expand Up @@ -83,5 +95,9 @@ utils::globalVariables(c(
"stime", # <calculate_censor_delay>
"stime_daily", # <calculate_censor_delay>
"ptime_daily", # <event_to_incidence>
"rlnorm", # <simulate_secondary>
"delay", # <simulate_secondary>
"stime", # <simulate_secondary>
"ptime", # <simulate_secondary>
NULL
))
4 changes: 1 addition & 3 deletions R/latent_individual.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#' @method epidist_prepare epidist_latent_individual
#' @family latent_individual
#' @autoglobal
#' @export
epidist_prepare.epidist_latent_individual <- function(data, ...) {
id <- obs_t <- obs_at <- ptime_lwr <- pwindow_upr <- stime_lwr <- NULL
stime_upr <- woverlap <- swindow_upr <- stime_upr <- delay_central <- NULL
row_id <- ptime_upr <- NULL
data <- data.table::as.data.table(data)
data[, id := seq_len(.N)]
data[, obs_t := obs_at - ptime_lwr]
Expand Down
2 changes: 1 addition & 1 deletion R/simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ simulate_gillespie <- function(r = 0.2,
#' (secondary event latency) and `stime` (the time of the secondary event).
#'
#' @family simulate
#' @autoglobal
#' @export
simulate_secondary <- function(linelist, dist = rlnorm, ...) {
delay <- ptime <- stime <- NULL
obs <- data.table::copy(linelist)

obs[, delay := dist(.N, ...)]
Expand Down

0 comments on commit 290bdfb

Please sign in to comment.