Skip to content

Commit

Permalink
catch missing dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Dec 11, 2023
1 parent 5c9ffbf commit 519bc3c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ Imports:
cmdstanr,
data.table,
ggplot2,
posterior,
purrr
Remotes:
stan-dev/cmdstanr,
Rdatatable/data.table
Suggests:
epinowcast,
testthat (>= 3.0.0)
Remotes:
stan-dev/cmdstanr,
Rdatatable/data.table,
epinowcast/epinowcast
Config/testthat/edition: 3
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ import(brms)
import(cmdstanr)
import(data.table)
import(ggplot2)
importFrom(posterior,as_draws_df)
1 change: 1 addition & 0 deletions R/fitting-and-postprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ add_natural_scale_mean_sd <- function(dt) {

#' Extract posterior samples for a lognormal brms model
#' @export
#' @importFrom posterior as_draws_df
extract_lognormal_draws <- function(
data, id_vars, from_dt = FALSE
) {
Expand Down
6 changes: 6 additions & 0 deletions R/models.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,12 @@ epinowcast_delay <- function(formula = ~ 1, data, by = c(),
sampler = epinowcast::enw_sample,
with_epinowcast_output = TRUE,
...) {
# check if the epinowcast package is installed and error if not
if (!requireNamespace("epinowcast", quietly = TRUE)) {
stop(
"epinowcast is not installed. Please install it to use this function"
)
}
data_as_counts <- data |>
data.table::as.data.table() |>
DT(, .(new_confirm = .N), by = c("ptime_daily", "stime_daily", by)) |>
Expand Down

0 comments on commit 519bc3c

Please sign in to comment.