Skip to content

Commit

Permalink
minor tweaks to package family org
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Nov 15, 2024
1 parent d13f0ed commit dbe7821
Show file tree
Hide file tree
Showing 23 changed files with 112 additions and 46 deletions.
2 changes: 2 additions & 0 deletions R/assert_epidist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions R/direct_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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")
Expand Down
14 changes: 9 additions & 5 deletions R/epidist_linelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/latent_individual.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
Empty file removed R/validate.R
Empty file.
12 changes: 6 additions & 6 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion man/as_direct_model.Rd

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

4 changes: 3 additions & 1 deletion man/as_direct_model.epidist_linelist.Rd

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

9 changes: 6 additions & 3 deletions man/as_epidist_linelist.Rd

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

9 changes: 6 additions & 3 deletions man/as_epidist_linelist.data.frame.Rd

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

9 changes: 9 additions & 0 deletions man/as_epidist_linelist.default.Rd

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

4 changes: 2 additions & 2 deletions man/as_latent_individual.Rd

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

6 changes: 2 additions & 4 deletions man/assert_epidist.Rd

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

20 changes: 20 additions & 0 deletions man/assert_epidist.epidist_linelist.Rd

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

4 changes: 2 additions & 2 deletions man/epidist_family_model.epidist_latent_individual.Rd

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

4 changes: 2 additions & 2 deletions man/epidist_formula_model.epidist_latent_individual.Rd

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

11 changes: 5 additions & 6 deletions man/is_direct_model.Rd

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

9 changes: 6 additions & 3 deletions man/is_epidist_linelist.Rd

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

2 changes: 1 addition & 1 deletion man/is_latent_individual.Rd

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

8 changes: 7 additions & 1 deletion man/new_epidist_direct_model.Rd

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

9 changes: 8 additions & 1 deletion man/new_epidist_latent_individual.Rd

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

10 changes: 9 additions & 1 deletion man/new_epidist_linelist.Rd

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

0 comments on commit dbe7821

Please sign in to comment.