Skip to content

Commit

Permalink
added ssd_dists_shiny()
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Dec 19, 2024
1 parent f62fe06 commit 1f0b3ca
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 3 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export(ssd_data)
export(ssd_dists)
export(ssd_dists_all)
export(ssd_dists_bcanz)
export(ssd_dists_shiny)
export(ssd_eburrIII3)
export(ssd_ecd)
export(ssd_ecd_data)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# ssdtools 2.2.0

- Added `ssd_label_comma_hc()` function to label numbers with significant digits and comma and offset hazard concentration value if present in breaks.
- Added `ssd_dists_shiny()` to define distributions for use in shiny app.
- For `plot_coord_scale()` function:
- Added `x_limits = NULL` to allow setting of x-axis limits.
- Added `hc_value = NULL` to pass hazard concentration value.
Expand Down
15 changes: 15 additions & 0 deletions R/dists.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,18 @@ ssd_dists <- function(bcanz = NULL, tails = NULL, npars = 2:5) {
ssd_dists_all <- function() {
ssd_dists(bcanz = NULL, tails = NULL, npars = 2:5)
}

#' All Shiny Species Sensitivity Distributions
#'
#' Gets a character vector of the names of all the available distributions
#' in the shinyssdtools.
#'
#' @return A unique, sorted character vector of the distributions.
#' @family dists
#' @export
#'
#' @examples
#' ssd_dists_shiny()
ssd_dists_shiny <- function() {
ssd_dists(bcanz = NULL, tails = TRUE, npars = 2:5)
}
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ reference:
- ssd_dists
- ssd_dists_all
- ssd_dists_bcanz
- ssd_dists_shiny
- title: Fit
desc: Functions that fit distributions to data
contents:
Expand Down
3 changes: 2 additions & 1 deletion man/dist_data.Rd

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

3 changes: 2 additions & 1 deletion man/ssd_dists.Rd

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

3 changes: 2 additions & 1 deletion man/ssd_dists_all.Rd

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

25 changes: 25 additions & 0 deletions man/ssd_dists_shiny.Rd

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

10 changes: 10 additions & 0 deletions tests/testthat/test-dists.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ test_that("dists all", {
)
})

test_that("dists shiny", {
expect_identical(
ssd_dists_shiny(),
c(
"burrIII3", "gamma", "gompertz", "lgumbel", "llogis",
"llogis_llogis", "lnorm", "lnorm_lnorm", "weibull"
)
)
})

test_that("dists all", {
expect_identical(ssd_dists(), ssd_dists_all())
})
Expand Down

0 comments on commit 1f0b3ca

Please sign in to comment.