diff --git a/R/assert_epidist.R b/R/assert_epidist.R index ef8a7e12c..b0a2502d8 100644 --- a/R/assert_epidist.R +++ b/R/assert_epidist.R @@ -4,11 +4,13 @@ #' @param ... Additional arguments #' @return NULL invisibly #' @export +#' @family assert assert_epidist <- function(data, ...) { UseMethod("assert_epidist") } #' @export +#' @family assert assert_epidist.default <- function(data, ...) { cli_abort( c( diff --git a/R/direct_model.R b/R/direct_model.R index 9e7dcecbf..43862fd67 100644 --- a/R/direct_model.R +++ b/R/direct_model.R @@ -29,7 +29,7 @@ as_direct_model.epidist_linelist <- function(data) { #' #' @param data A data.frame to convert #' @returns An object of class `epidist_direct_model` -#' @keywords internal +#' @family direct_model #' @export new_epidist_direct_model <- function(data) { class(data) <- c("epidist_direct_model", class(data)) @@ -48,7 +48,7 @@ assert_epidist.epidist_direct_model <- function(data, ...) { #' Check if data has the `epidist_direct_model` class #' #' @param data A `data.frame` containing line list data -#' @family latent_individual +#' @family direct_model #' @export is_direct_model <- function(data) { inherits(data, "epidist_direct_model") diff --git a/R/epidist_linelist.R b/R/epidist_linelist.R index 5b6d609a7..239e7b9f9 100644 --- a/R/epidist_linelist.R +++ b/R/epidist_linelist.R @@ -2,7 +2,7 @@ #' #' @param data The data to convert #' @param ... Additional arguments passed to methods -#' @family preprocess +#' @family linelist #' @export as_epidist_linelist <- function(data, ...) { UseMethod("as_epidist_linelist") @@ -18,6 +18,7 @@ as_epidist_linelist <- function(data, ...) { #' @param ... Additional columns to add to the epidist_linelist object #' @importFrom tibble tibble #' @importFrom dplyr bind_cols +#' @family linelist #' @export as_epidist_linelist.default <- function( data, ptime_upr = NULL, stime_lwr = NULL, stime_upr = NULL, @@ -53,7 +54,7 @@ as_epidist_linelist.default <- function( #' @param obs_date A string giving the column of `data` containing the #' observation time as a datetime. #' @param ... Additional arguments passed to methods -#' @family preprocess +#' @family linelist #' @importFrom dplyr bind_cols #' @export as_epidist_linelist.data.frame <- function( @@ -101,7 +102,7 @@ as_epidist_linelist.data.frame <- function( #' #' @param data A data.frame to convert #' @returns An object of class `epidist_linelist` -#' @keywords internal +#' @family linelist #' @export new_epidist_linelist <- function(data) { class(data) <- c("epidist_linelist", class(data)) @@ -112,13 +113,16 @@ new_epidist_linelist <- function(data) { #' #' @inheritParams as_epidist_linelist #' @param ... Additional arguments -#' @family preprocess +#' @family linelist #' @export is_epidist_linelist <- function(data, ...) { inherits(data, "epidist_linelist") } -#' @rdname assert_epidist +#' Assert validity of `epidist_linelist` objects +#' +#' @method assert_epidist epidist_linelist +#' @family linelist #' @export assert_epidist.epidist_linelist <- function(data, ...) { assert_data_frame(data) diff --git a/R/latent_individual.R b/R/latent_individual.R index 067f4c44f..3d19e796d 100644 --- a/R/latent_individual.R +++ b/R/latent_individual.R @@ -35,7 +35,7 @@ as_latent_individual.epidist_linelist <- function(data) { #' #' @param data A data.frame to convert #' @returns An object of class `epidist_latent_individual` -#' @keywords internal +#' @family latent_individual #' @export new_epidist_latent_individual <- function(data) { class(data) <- c("epidist_latent_individual", class(data)) diff --git a/R/utils.R b/R/utils.R index a2cef2f8c..6f5990ff3 100644 --- a/R/utils.R +++ b/R/utils.R @@ -8,7 +8,7 @@ #' @return A character string containing the Stan code chunk of interest. #' @keywords internal .stan_chunk <- function(path) { - local_path <- system.file(paste0("stan/", path), package = "epidist") + local_path <- system.file("stan", path, package = "epidist") paste(readLines(local_path), collapse = "\n") } diff --git a/R/validate.R b/R/validate.R deleted file mode 100644 index e69de29bb..000000000 diff --git a/_pkgdown.yml b/_pkgdown.yml index 06b1422ac..8afc15c2a 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -37,14 +37,14 @@ reference: desc: Functions for observing data contents: - has_concept("observe") -- title: Preprocess - desc: Functions for preprocessing data +- title: Linelist data + desc: Functions for preparing linelist data contents: - - has_concept("preprocess") -- title: Validation - desc: Functions used to check validity of package objects + - has_concept("linelist") +- title: Assert validity of objects + desc: Functions used to assert the validity of package objects contents: - - has_concept("validate") + - has_concept("assert") - title: Family desc: Functions related to specifying custom `brms` families contents: diff --git a/man/as_direct_model.Rd b/man/as_direct_model.Rd index a9f9c2be2..49354315a 100644 --- a/man/as_direct_model.Rd +++ b/man/as_direct_model.Rd @@ -14,6 +14,8 @@ Prepare direct model to pass through to \code{brms} } \seealso{ Other direct_model: -\code{\link{as_direct_model.epidist_linelist}()} +\code{\link{as_direct_model.epidist_linelist}()}, +\code{\link{is_direct_model}()}, +\code{\link{new_epidist_direct_model}()} } \concept{direct_model} diff --git a/man/as_direct_model.epidist_linelist.Rd b/man/as_direct_model.epidist_linelist.Rd index fd921117a..8102d30ac 100644 --- a/man/as_direct_model.epidist_linelist.Rd +++ b/man/as_direct_model.epidist_linelist.Rd @@ -14,6 +14,8 @@ The direct model method for \code{epidist_linelist} objects } \seealso{ Other direct_model: -\code{\link{as_direct_model}()} +\code{\link{as_direct_model}()}, +\code{\link{is_direct_model}()}, +\code{\link{new_epidist_direct_model}()} } \concept{direct_model} diff --git a/man/as_epidist_linelist.Rd b/man/as_epidist_linelist.Rd index 8d5e21b65..4bd631131 100644 --- a/man/as_epidist_linelist.Rd +++ b/man/as_epidist_linelist.Rd @@ -15,8 +15,11 @@ as_epidist_linelist(data, ...) Create an epidist_linelist object } \seealso{ -Other preprocess: +Other linelist: \code{\link{as_epidist_linelist.data.frame}()}, -\code{\link{is_epidist_linelist}()} +\code{\link{as_epidist_linelist.default}()}, +\code{\link{assert_epidist.epidist_linelist}()}, +\code{\link{is_epidist_linelist}()}, +\code{\link{new_epidist_linelist}()} } -\concept{preprocess} +\concept{linelist} diff --git a/man/as_epidist_linelist.data.frame.Rd b/man/as_epidist_linelist.data.frame.Rd index a1d330a2f..107a17db7 100644 --- a/man/as_epidist_linelist.data.frame.Rd +++ b/man/as_epidist_linelist.data.frame.Rd @@ -30,8 +30,11 @@ observation time as a datetime.} Create an epidist_linelist object from a data frame with event dates } \seealso{ -Other preprocess: +Other linelist: \code{\link{as_epidist_linelist}()}, -\code{\link{is_epidist_linelist}()} +\code{\link{as_epidist_linelist.default}()}, +\code{\link{assert_epidist.epidist_linelist}()}, +\code{\link{is_epidist_linelist}()}, +\code{\link{new_epidist_linelist}()} } -\concept{preprocess} +\concept{linelist} diff --git a/man/as_epidist_linelist.default.Rd b/man/as_epidist_linelist.default.Rd index 746ef1d41..c8bb7f117 100644 --- a/man/as_epidist_linelist.default.Rd +++ b/man/as_epidist_linelist.default.Rd @@ -28,3 +28,12 @@ secondary times} \description{ Create an epidist_linelist object from vectors of event times } +\seealso{ +Other linelist: +\code{\link{as_epidist_linelist}()}, +\code{\link{as_epidist_linelist.data.frame}()}, +\code{\link{assert_epidist.epidist_linelist}()}, +\code{\link{is_epidist_linelist}()}, +\code{\link{new_epidist_linelist}()} +} +\concept{linelist} diff --git a/man/as_latent_individual.Rd b/man/as_latent_individual.Rd index 6222f7dab..1afea62d7 100644 --- a/man/as_latent_individual.Rd +++ b/man/as_latent_individual.Rd @@ -16,7 +16,7 @@ Convert an object to an \code{epidist_latent_individual} object Other latent_individual: \code{\link{epidist_family_model.epidist_latent_individual}()}, \code{\link{epidist_formula_model.epidist_latent_individual}()}, -\code{\link{is_direct_model}()}, -\code{\link{is_latent_individual}()} +\code{\link{is_latent_individual}()}, +\code{\link{new_epidist_latent_individual}()} } \concept{latent_individual} diff --git a/man/assert_epidist.Rd b/man/assert_epidist.Rd index 5205c487f..64a11b4e5 100644 --- a/man/assert_epidist.Rd +++ b/man/assert_epidist.Rd @@ -1,13 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/assert_epidist.R, R/epidist_linelist.R +% Please edit documentation in R/assert_epidist.R \name{assert_epidist} \alias{assert_epidist} -\alias{assert_epidist.epidist_linelist} \title{Validation for epidist objects} \usage{ assert_epidist(data, ...) - -\method{assert_epidist}{epidist_linelist}(data, ...) } \arguments{ \item{data}{Object to validate} @@ -20,3 +17,4 @@ NULL invisibly \description{ Validation for epidist objects } +\concept{assert} diff --git a/man/assert_epidist.epidist_linelist.Rd b/man/assert_epidist.epidist_linelist.Rd new file mode 100644 index 000000000..5d6f715fd --- /dev/null +++ b/man/assert_epidist.epidist_linelist.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/epidist_linelist.R +\name{assert_epidist.epidist_linelist} +\alias{assert_epidist.epidist_linelist} +\title{Assert validity of \code{epidist_linelist} objects} +\usage{ +\method{assert_epidist}{epidist_linelist}(data, ...) +} +\description{ +Assert validity of \code{epidist_linelist} objects +} +\seealso{ +Other linelist: +\code{\link{as_epidist_linelist}()}, +\code{\link{as_epidist_linelist.data.frame}()}, +\code{\link{as_epidist_linelist.default}()}, +\code{\link{is_epidist_linelist}()}, +\code{\link{new_epidist_linelist}()} +} +\concept{linelist} diff --git a/man/epidist_family_model.epidist_latent_individual.Rd b/man/epidist_family_model.epidist_latent_individual.Rd index b73050a74..ee74e5d6c 100644 --- a/man/epidist_family_model.epidist_latent_individual.Rd +++ b/man/epidist_family_model.epidist_latent_individual.Rd @@ -21,7 +21,7 @@ Create the model-specific component of an \code{epidist} custom family Other latent_individual: \code{\link{as_latent_individual}()}, \code{\link{epidist_formula_model.epidist_latent_individual}()}, -\code{\link{is_direct_model}()}, -\code{\link{is_latent_individual}()} +\code{\link{is_latent_individual}()}, +\code{\link{new_epidist_latent_individual}()} } \concept{latent_individual} diff --git a/man/epidist_formula_model.epidist_latent_individual.Rd b/man/epidist_formula_model.epidist_latent_individual.Rd index 4830098ee..16fb425ed 100644 --- a/man/epidist_formula_model.epidist_latent_individual.Rd +++ b/man/epidist_formula_model.epidist_latent_individual.Rd @@ -20,7 +20,7 @@ Define the model-specific component of an \code{epidist} custom formula Other latent_individual: \code{\link{as_latent_individual}()}, \code{\link{epidist_family_model.epidist_latent_individual}()}, -\code{\link{is_direct_model}()}, -\code{\link{is_latent_individual}()} +\code{\link{is_latent_individual}()}, +\code{\link{new_epidist_latent_individual}()} } \concept{latent_individual} diff --git a/man/is_direct_model.Rd b/man/is_direct_model.Rd index fbeea635c..4cca290d7 100644 --- a/man/is_direct_model.Rd +++ b/man/is_direct_model.Rd @@ -13,10 +13,9 @@ is_direct_model(data) Check if data has the \code{epidist_direct_model} class } \seealso{ -Other latent_individual: -\code{\link{as_latent_individual}()}, -\code{\link{epidist_family_model.epidist_latent_individual}()}, -\code{\link{epidist_formula_model.epidist_latent_individual}()}, -\code{\link{is_latent_individual}()} +Other direct_model: +\code{\link{as_direct_model}()}, +\code{\link{as_direct_model.epidist_linelist}()}, +\code{\link{new_epidist_direct_model}()} } -\concept{latent_individual} +\concept{direct_model} diff --git a/man/is_epidist_linelist.Rd b/man/is_epidist_linelist.Rd index 88b8521a7..8f258a22f 100644 --- a/man/is_epidist_linelist.Rd +++ b/man/is_epidist_linelist.Rd @@ -15,8 +15,11 @@ is_epidist_linelist(data, ...) Check if data has the \code{epidist_linelist} class } \seealso{ -Other preprocess: +Other linelist: \code{\link{as_epidist_linelist}()}, -\code{\link{as_epidist_linelist.data.frame}()} +\code{\link{as_epidist_linelist.data.frame}()}, +\code{\link{as_epidist_linelist.default}()}, +\code{\link{assert_epidist.epidist_linelist}()}, +\code{\link{new_epidist_linelist}()} } -\concept{preprocess} +\concept{linelist} diff --git a/man/is_latent_individual.Rd b/man/is_latent_individual.Rd index 94fb1428b..c913cf97e 100644 --- a/man/is_latent_individual.Rd +++ b/man/is_latent_individual.Rd @@ -17,6 +17,6 @@ Other latent_individual: \code{\link{as_latent_individual}()}, \code{\link{epidist_family_model.epidist_latent_individual}()}, \code{\link{epidist_formula_model.epidist_latent_individual}()}, -\code{\link{is_direct_model}()} +\code{\link{new_epidist_latent_individual}()} } \concept{latent_individual} diff --git a/man/new_epidist_direct_model.Rd b/man/new_epidist_direct_model.Rd index 7a539756c..ab702b403 100644 --- a/man/new_epidist_direct_model.Rd +++ b/man/new_epidist_direct_model.Rd @@ -15,4 +15,10 @@ An object of class \code{epidist_direct_model} \description{ Class constructor for \code{epidist_direct_model} objects } -\keyword{internal} +\seealso{ +Other direct_model: +\code{\link{as_direct_model}()}, +\code{\link{as_direct_model.epidist_linelist}()}, +\code{\link{is_direct_model}()} +} +\concept{direct_model} diff --git a/man/new_epidist_latent_individual.Rd b/man/new_epidist_latent_individual.Rd index 0a8f72ef4..de93bab20 100644 --- a/man/new_epidist_latent_individual.Rd +++ b/man/new_epidist_latent_individual.Rd @@ -15,4 +15,11 @@ An object of class \code{epidist_latent_individual} \description{ Class constructor for \code{epidist_latent_individual} objects } -\keyword{internal} +\seealso{ +Other latent_individual: +\code{\link{as_latent_individual}()}, +\code{\link{epidist_family_model.epidist_latent_individual}()}, +\code{\link{epidist_formula_model.epidist_latent_individual}()}, +\code{\link{is_latent_individual}()} +} +\concept{latent_individual} diff --git a/man/new_epidist_linelist.Rd b/man/new_epidist_linelist.Rd index eb1461c4b..e3b44e5a4 100644 --- a/man/new_epidist_linelist.Rd +++ b/man/new_epidist_linelist.Rd @@ -15,4 +15,12 @@ An object of class \code{epidist_linelist} \description{ Class constructor for \code{epidist_linelist} objects } -\keyword{internal} +\seealso{ +Other linelist: +\code{\link{as_epidist_linelist}()}, +\code{\link{as_epidist_linelist.data.frame}()}, +\code{\link{as_epidist_linelist.default}()}, +\code{\link{assert_epidist.epidist_linelist}()}, +\code{\link{is_epidist_linelist}()} +} +\concept{linelist}