Skip to content

Commit

Permalink
update variable names used in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlambert committed Aug 12, 2024
1 parent 820436b commit f28ec86
Show file tree
Hide file tree
Showing 23 changed files with 287 additions and 287 deletions.
16 changes: 8 additions & 8 deletions R/accessors.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ get_parameters <- function(x, ...) {
#' @export
#'
#' @examples
#' edist <- epiparameter_db(
#' ep <- epiparameter_db(
#' disease = "COVID-19",
#' epi_dist = "serial interval",
#' single_epiparameter = TRUE
#' )
#' get_parameters(edist)
#' get_parameters(ep)
get_parameters.epiparameter <- function(x, ...) {
chkDots(...)
# extract parameters depending on prob distribution class
Expand Down Expand Up @@ -88,12 +88,12 @@ get_citation <- function(x, ...) {
#'
#' @examples
#' # example with <epiparameter>
#' edist <- epiparameter_db(single_epiparameter = TRUE)
#' get_citation(edist)
#' ep <- epiparameter_db(single_epiparameter = TRUE)
#' get_citation(ep)
#'
#' # example returning bibtex format
#' edist <- epiparameter_db(disease = "COVID-19", single_epiparameter = TRUE)
#' cit <- get_citation(edist)
#' ep <- epiparameter_db(disease = "COVID-19", single_epiparameter = TRUE)
#' cit <- get_citation(ep)
#' format(cit, style = "bibtex")
get_citation.epiparameter <- function(x, ...) {
chkDots(...)
Expand All @@ -119,8 +119,8 @@ get_citation.epiparameter <- function(x, ...) {
#'
#' @examples
#' # example with list of <epiparameter>
#' edist <- epiparameter_db()
#' get_citation(edist)
#' db <- epiparameter_db()
#' get_citation(db)
get_citation.multi_epiparameter <- function(x, ...) {
chkDots(...)
# dispatches to get_citation.epiparameter method
Expand Down
12 changes: 6 additions & 6 deletions R/checkers.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
#'
#' @examples
#' # parameterised <epiparameter>
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation",
#' prob_distribution = "gamma",
#' prob_distribution_params = c(shape = 1, scale = 1)
#' )
#' is_parameterised(edist)
#' is_parameterised(ep)
#'
#' # unparameterised <epiparameter>
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation"
#' )
#' is_parameterised(edist)
#' is_parameterised(ep)
#'
#' # list of <epiparameter>
#' edist <- epiparameter_db()
#' is_parameterised(edist)
#' db <- epiparameter_db()
#' is_parameterised(db)
is_parameterised <- function(x, ...) {
UseMethod("is_parameterised")
}
Expand Down
48 changes: 24 additions & 24 deletions R/epiparameter.R
Original file line number Diff line number Diff line change
Expand Up @@ -457,23 +457,23 @@ format.epiparameter <- function(x, ...) {
#' @export
#'
#' @examples
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "serial_interval",
#' prob_distribution = "gamma",
#' prob_distribution_params = c(shape = 1, scale = 1)
#' )
#'
#' is_epiparameter(edist)
#' is_epiparameter(ep)
#'
#' false_edist <- list(
#' false_ep <- list(
#' disease = "ebola",
#' epi_dist = "serial_interval",
#' prob_distribution = "gamma",
#' prob_distribution_params = c(shape = 1, scale = 1)
#' )
#'
#' is_epiparameter(false_edist)
#' is_epiparameter(false_ep)
is_epiparameter <- function(x) {
inherits(x, "epiparameter")
}
Expand Down Expand Up @@ -501,18 +501,18 @@ is_epiparameter <- function(x) {
#' @keywords epiparameter_distribution_functions
#'
#' @examples
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation_period",
#' prob_distribution = "gamma",
#' prob_distribution_params = c(shape = 1, scale = 1)
#' )
#'
#' # example of each distribution method for an `epiparameter` object
#' stats::density(edist, at = 1)
#' distributional::cdf(edist, q = 1)
#' stats::quantile(edist, p = 0.2)
#' distributional::generate(edist, times = 10)
#' stats::density(ep, at = 1)
#' distributional::cdf(ep, q = 1)
#' stats::quantile(ep, p = 0.2)
#' distributional::generate(ep, times = 10)
NULL

#' @rdname epiparameter_distribution_functions
Expand Down Expand Up @@ -704,23 +704,23 @@ discretise.default <- function(x, ...) {
#'
#' @examples
#' # example with continuous distribution
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation_period",
#' prob_distribution = "gamma",
#' prob_distribution_params = c(shape = 1, scale = 1)
#' )
#' family(edist)
#' family(ep)
#'
#' # example with discretised distribution
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation_period",
#' prob_distribution = "lnorm",
#' prob_distribution_params = c(meanlog = 1, sdlog = 1),
#' discretise = TRUE
#' )
#' family(edist)
#' family(ep)
family.epiparameter <- function(object, ...) {
if (inherits(object$prob_dist, "distcrete")) {
prob_dist <- object$prob_dist$name
Expand Down Expand Up @@ -769,22 +769,22 @@ family.epiparameter <- function(object, ...) {
#' @export
#'
#' @examples
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation_period",
#' prob_distribution = "lnorm",
#' prob_distribution_params = c(meanlog = 1, sdlog = 1)
#' )
#' is_truncated(edist)
#' is_truncated(ep)
#'
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation_period",
#' prob_distribution = "lnorm",
#' prob_distribution_params = c(meanlog = 1, sdlog = 1),
#' truncation = 10
#' )
#' is_truncated(edist)
#' is_truncated(ep)
is_truncated <- function(x) {
stopifnot(
"is_truncated only works for `<epiparameter> objects`" =
Expand Down Expand Up @@ -824,22 +824,22 @@ is_truncated <- function(x) {
#' @export
#'
#' @examples
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation_period",
#' prob_distribution = "lnorm",
#' prob_distribution_params = c(meanlog = 1, sdlog = 1)
#' )
#' is_continuous(edist)
#' is_continuous(discretise(edist))
#' is_continuous(ep)
#' is_continuous(discretise(ep))
#'
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "offspring distribution",
#' prob_distribution = "nbinom",
#' prob_distribution_params = c(mean = 2, dispersion = 0.5)
#' )
#' is_continuous(edist)
#' is_continuous(ep)
is_continuous <- function(x) {
stopifnot(
"is_truncated only works for `<epiparameter> objects`" =
Expand All @@ -858,12 +858,12 @@ is_continuous <- function(x) {
#' @export
#'
#' @examples
#' edist <- epiparameter_db(
#' ep <- epiparameter_db(
#' disease = "COVID-19",
#' epi_dist = "incubation period",
#' single_epiparameter = TRUE
#' )
#' mean(edist)
#' mean(ep)
mean.epiparameter <- function(x, ...) {
chkDots(...)
# extract mean if given
Expand Down
12 changes: 6 additions & 6 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
#'
#' @examples
#' # plot continuous epiparameter
#' edist <- epiparameter(
#' ep <- epiparameter(
#' disease = "ebola",
#' epi_dist = "incubation_period",
#' prob_distribution = "gamma",
#' prob_distribution_params = c(shape = 2, scale = 1)
#' )
#' plot(edist)
#' plot(ep)
#'
#' # plot different day range (x-axis)
#' plot(edist, xlim = c(0, 10))
#' plot(ep, xlim = c(0, 10))
#'
#' # plot CDF
#' plot(edist, cumulative = TRUE)
#' plot(ep, cumulative = TRUE)
#'
#' # plot discrete epiparameter
#' edist <- discretise(edist)
#' plot(edist)
#' ep <- discretise(ep)
#' plot(ep)
plot.epiparameter <- function(x,
cumulative = FALSE,
...) {
Expand Down
10 changes: 5 additions & 5 deletions man/epiparameter_distribution_functions.Rd

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

8 changes: 4 additions & 4 deletions man/family.epiparameter.Rd

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

8 changes: 4 additions & 4 deletions man/get_citation.epiparameter.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/get_citation.multi_epiparameter.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/get_parameters.epiparameter.Rd

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

10 changes: 5 additions & 5 deletions man/is_continuous.Rd

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

8 changes: 4 additions & 4 deletions man/is_epiparameter.Rd

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

Loading

0 comments on commit f28ec86

Please sign in to comment.