diff --git a/DESCRIPTION b/DESCRIPTION index 4ae1c24..8f2e37a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Type: Package Package: distspec -Title: Define Probability Distributions with Certain or Uncertain Parameters +Title: Probability Distributions with Certain or Uncertain Parameters Version: 0.1.0 Authors@R: c(person(given = "Sebastian", diff --git a/R/dist_spec.R b/R/dist_spec.R index 6b54057..860a6ba 100644 --- a/R/dist_spec.R +++ b/R/dist_spec.R @@ -457,6 +457,7 @@ max.multi_dist_spec <- function(x, ...) { #' print(dist2) print.dist_spec <- function(x, ...) { print_dist_spec_indented(x, indent = 0, ...) + invisible(x) } #' @keywords internal print_dist_spec_indented <- function(x, indent, ...) { @@ -553,7 +554,7 @@ print_dist_spec_indented <- function(x, indent, ...) { #' @importFrom rlang .data `%||%` #' @importFrom cli cli_abort cli_warn #' @export -#' @examples +#' @examplesIf rlang::is_installed("ggplot2") #' # A fixed lognormal distribution with mean 5 and sd 1. #' dist1 <- LogNormal(mean = 1.6, sd = 0.5, max = 20) #' # Plot discretised distribution with 1 day discretisation window @@ -672,22 +673,6 @@ plot.dist_spec <- function(x, samples = 50L, res = 1, cumulative = TRUE, ...) { #' @importFrom cli cli_abort #' @return A single `dist_spec` object #' @keywords internal -#' @examples -#' dist1 <- LogNormal(mean = 1.6, sd = 0.5, max = 20) -#' -#' # An uncertain gamma distribution with shape and rate normally distributed -#' # as Normal(3, 0.5) and Normal(2, 0.5) respectively -#' dist2 <- Gamma( -#' shape = Normal(3, 0.5), -#' rate = Normal(2, 0.5), -#' max = 20 -#' ) -#' -#' # Multiple distributions -#' \dontrun{ -#' dist <- dist1 + dist2 -#' extract_single_dist(dist, 2) -#' } extract_single_dist <- function(x, i) { if (i > ndist(x)) { cli_abort( diff --git a/inst/WORDLIST b/inst/WORDLIST index 71debe6..d7e7476 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,26 +1,32 @@ CMD +CensoredDistributions Charniga Codecov +ComposedDistributions Dirichlet Discretisation Discretise Discretised Discretising EpiNow +Lifecycle ORCID PMF PMFs +Un cleanups cutoff dependabot discretisation discretise discretised +discretises dist erroring etc github jamesmbaazam +jl medRxiv nonzero pmf @@ -29,3 +35,4 @@ roxygen sbfnk sd seabbs +th diff --git a/man/distspec-package.Rd b/man/distspec-package.Rd index 3a5fa99..6de8d44 100644 --- a/man/distspec-package.Rd +++ b/man/distspec-package.Rd @@ -4,7 +4,7 @@ \name{distspec-package} \alias{distspec} \alias{distspec-package} -\title{distspec: Define Probability Distributions with Certain or Uncertain Parameters} +\title{distspec: Probability Distributions with Certain or Uncertain Parameters} \description{ Represents probability distributions with fixed or potentially uncertain parameters, with tools to discretise, convolve, sample from and summarise them. } diff --git a/man/extract_single_dist.Rd b/man/extract_single_dist.Rd index 7b883ca..79c1077 100644 --- a/man/extract_single_dist.Rd +++ b/man/extract_single_dist.Rd @@ -17,21 +17,4 @@ A single \code{dist_spec} object \description{ Extract a single element of a composite \verb{} } -\examples{ -dist1 <- LogNormal(mean = 1.6, sd = 0.5, max = 20) - -# An uncertain gamma distribution with shape and rate normally distributed -# as Normal(3, 0.5) and Normal(2, 0.5) respectively -dist2 <- Gamma( - shape = Normal(3, 0.5), - rate = Normal(2, 0.5), - max = 20 -) - -# Multiple distributions -\dontrun{ -dist <- dist1 + dist2 -extract_single_dist(dist, 2) -} -} \keyword{internal} diff --git a/man/plot.dist_spec.Rd b/man/plot.dist_spec.Rd index 53d66d9..d295de4 100644 --- a/man/plot.dist_spec.Rd +++ b/man/plot.dist_spec.Rd @@ -36,6 +36,7 @@ and no \code{cdf_cutoff} of its own raises an error; bound it first (e.g. with \code{\link[=bound_dist]{bound_dist()}}). } \examples{ +\dontshow{if (rlang::is_installed("ggplot2")) withAutoprint(\{ # examplesIf} # A fixed lognormal distribution with mean 5 and sd 1. dist1 <- LogNormal(mean = 1.6, sd = 0.5, max = 20) # Plot discretised distribution with 1 day discretisation window @@ -55,4 +56,5 @@ plot(dist2) # Multiple distributions with 0.1 discretisation window and do not plot the # cumulative distribution plot(dist1 + dist2, res = 0.1, cumulative = FALSE) +\dontshow{\}) # examplesIf} }