Skip to content

Commit

Permalink
Issue 17: Fixes to data.table assignment (#18)
Browse files Browse the repository at this point in the history
* Add omitted assignments

* Correct typo (draw to draws) as suggested by seabbs

* Add Adam Howes as contributor

Former-commit-id: 358d4706f12e5c68058a627f9fa101d8e40eae76 [formerly efd2f7e7a841c31d86106f231ebeab82989de206]
Former-commit-id: 59460a126c53f6fa91f66c3f51ec3b405d4069f0
  • Loading branch information
athowes authored May 10, 2024
1 parent 284b0dc commit fb1800c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ Authors@R:
person(given = "Sam Abbott",
role = c("aut"),
email = "contact@samabbott.co.uk",
comment = c(ORCID = "0000-0001-8057-8037")))
comment = c(ORCID = "0000-0001-8057-8037")),
person(given = "Adam Howes",
role = c("aut"),
email = "adamthowes@gmail.com",
comment = c(ORCID = "0000-0003-2386-4031")))
Description: Understanding and accurately estimating epidemiological delay
distributions is important for public health policy. These estimates
directly influence epidemic situational awareness, control strategies, and resource allocation. In this package, we provide methods to address the key challenges in estimating these distributions, including truncation, interval censoring, and dynamical biases. Despite their importance, these issues are frequently overlooked, often resulting in biased conclusions.
Expand Down
2 changes: 1 addition & 1 deletion R/fitting-and-postprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ primary_censoring_bias_correction <- function(draws) {
draws <- data.table::copy(draws)
draws[, mean := mean - runif(.N, min = 0, max = 1)]
draws[, meanlog := log(mean^2 / sqrt(sd^2 + mean^2))]
draw[, sdlog := sqrt(log(1 + (sd^2 / mean^2)))]
draws[, sdlog := sqrt(log(1 + (sd^2 / mean^2)))]

return(draws[])
}
Expand Down
2 changes: 1 addition & 1 deletion R/observe.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pad_zero <- function(data, pad = 1e-3) {
#' @export
drop_zero <- function(data) {
data <- data.table::copy(data)
data[delay_daily != 0]
data <- data[delay_daily != 0]

return(data)
}
2 changes: 1 addition & 1 deletion R/plot-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ calculate_cohort_mean <- function(data, type = c("cohort", "cumulative"),
mean = mean(delay_daily), n = .N),
by = c("ptime_daily", by)]

out[order(rank(ptime_daily))]
out <- out[order(rank(ptime_daily))]

if (type == "cumulative") {
out[, mean := cumsum(mean * n) / cumsum(n), by = by]
Expand Down
2 changes: 1 addition & 1 deletion R/preprocess.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ event_to_incidence <- function(data, by = c()) {
dd <- data.table::copy(data)

dd[, .(cases = .N), by = c("ptime_daily", by)]
dd[order(ptime_daily)]
dd <- dd[order(ptime_daily)]

setnames(dd, old = c("ptime_daily"), new = c("time"))

Expand Down

0 comments on commit fb1800c

Please sign in to comment.