Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Issue #3: Adds EpiLPS method #7

Merged
merged 6 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(summarize_rtestimate,Rt)
S3method(summarize_rtestimate,cv_poisson_rt)
S3method(summarize_rtestimate,default)
S3method(summarize_rtestimate,epinow)
Expand Down
31 changes: 23 additions & 8 deletions R/summarize_rtestimate.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

#' Create a new summary object
#'
#'
#' Creates a new summary object for the `summrt` package while validating the input.
#'
#'
#' @param date Integer vector. vector of index dates.
#' @param median Double vector. vector of median values.
#' @param lb Double vector. vector of lower bounds.
#' @param ub Double vector. vector of upper bounds.
#' @param package String. Name of the package.
#' @export
#' @export
#' @return A list of class `summrt_summary`. with the following components:
#' - `date`: Integer vector. vector of index dates.
#' - `median`: Double vector. vector of median values.
Expand Down Expand Up @@ -115,25 +114,41 @@ summarize_rtestimate.epinow <- function(x, level = 0.95, ...) {
if (!requireNamespace("EpiNow2", quietly = TRUE)) {
cli::cli_abort("You must install the {.pkg EpiNow2} package for this functionality.")
}
checkmate::assert_number(level, lower = 0, upper = 1)

# res <- x$estimates$summarized |> dplyr::select()
}

#' @export
#' @export
#' @details The `estimate_R` method is for the `EpiEstim` package.
#' @rdname summarize_rtestimate
summarize_rtestimate.estimate_R <- function(x, ...) {

if (!requireNamespace("EpiEstim", quietly = TRUE)) {
cli::cli_abort("You must install the {.pkg EpiEstim} package for this functionality.")
}

new_summarize(
date = x$R$t_end,
median = x$R$`Median(R)`,
lb = x$R$`Quantile.0.025(R)`,
ub = x$R$`Quantile.0.975(R)`,
package = "EpiEstim"
)
}
}

#' @export
#' @details The `Rt` method is for the `EpiLPS` package.
#' @rdname summarize_rtestimate
summarize_rtestimate.Rt <- function(x, ...) {
if (!requireNamespace("EpiLPS", quietly = TRUE)) {
cli::cli_abort("You must install the {.pkg EpiLPS} package for this functionality.")
}

new_summarize(
date = x$RLPS$Time,
median = x$RLPS$Rq0.50,
lb = x$RLPS$Rq0.025,
ub = x$RLPS$Rq0.975,
package = "EpiLPS"
)
}
5 changes: 5 additions & 0 deletions man/summarize_rtestimate.Rd

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

Loading