Skip to content

Commit

Permalink
Merge pull request #310 from poissonconsulting/dev
Browse files Browse the repository at this point in the history
More housekeeping
  • Loading branch information
joethorley committed Oct 16, 2023
2 parents 9835e29 + 4d786c2 commit 00ce732
Show file tree
Hide file tree
Showing 47 changed files with 52 additions and 472 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Depends:
Imports:
abind,
chk,
doFuture,
foreach,
furrr,
generics,
ggplot2,
Expand All @@ -70,8 +68,10 @@ Imports:
VGAM
Suggests:
covr,
doFuture,
dplyr,
fitdistrplus,
foreach,
future,
glue,
grDevices,
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export(rgompertz)
export(rlgumbel)
export(scale_color_ssd)
export(scale_colour_ssd)
export(ssd_cfplot)
export(ssd_data)
export(ssd_dists)
export(ssd_dists_all)
Expand Down Expand Up @@ -157,7 +156,6 @@ importFrom(lifecycle,deprecate_warn)
importFrom(lifecycle,expect_deprecated)
importFrom(parallel,nextRNGStream)
importFrom(parallel,nextRNGSubStream)
importFrom(plyr,llply)
importFrom(plyr,summarise)
importFrom(purrr,transpose)
importFrom(scales,comma)
Expand Down
2 changes: 1 addition & 1 deletion R/censor.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ censoring_text <- function(x) {
#' fits <- ssd_fit_dists(ssddata::ccme_boron)
#' is_censored(fits)
is_censored <- function(x) {
deprecate_soft("0.3.7", "is_censored()", "ssd_is_censored()")
lifecycle::deprecate_warn("0.3.7", "is_censored()", "ssd_is_censored()")
chk_s3_class(x, "fitdists")
ssd_is_censored(x)
}
Expand Down
54 changes: 0 additions & 54 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,60 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#' CCME Species Sensitivity Data
#'
#' Species Sensitivity Data from
#' the Canadian Council of Ministers of the Environment.
#' The taxonomic groups are Amphibian, Fish, Invertebrate and Plant.
#' Plants includes freshwater algae.
#' Please use `[ssddata::ccme_data]` instead.
#'
#' Additional information on each of the chemicals is available from the
#' CCME website.
#' \describe{
#' \item{Boron}{<http://ceqg-rcqe.ccme.ca/download/en/324/>}
#' \item{Cadmium}{<http://ceqg-rcqe.ccme.ca/download/en/148/>}
#' \item{Chloride}{<http://ceqg-rcqe.ccme.ca/download/en/337/>}
#' \item{Endosulfan}{<http://ceqg-rcqe.ccme.ca/download/en/327/>}
#' \item{Glyphosate}{<http://ceqg-rcqe.ccme.ca/download/en/182/>}
#' \item{Uranium}{<http://ceqg-rcqe.ccme.ca/download/en/328/>}
#' \item{Silver}{<http://ceqg-rcqe.ccme.ca/download/en/355/>}
#' }
#'
#' \describe{
#' \item{Chemical}{The chemical (chr).}
#' \item{Species}{The species binomial name (chr).}
#' \item{Conc}{The chemical concentration (dbl).}
#' \item{Group}{The taxonomic group (fctr).}
#' \item{Units}{The units (chr).}
#' }
#' @examples
#' head(ccme_data)
"ccme_data"

#' CCME Species Sensitivity Data for Boron
#'
#' Species Sensitivity Data from
#' the Canadian Council of Ministers of the Environment.
#' Please use `[ssddata::ccme_data]` instead.
#'
#' Additional information is available from <http://ceqg-rcqe.ccme.ca/download/en/324/>.
#'
#' The columns are as follows
#'
#' \describe{
#' \item{Chemical}{The chemical (chr).}
#' \item{Species}{The species binomial name (chr).}
#' \item{Concentration}{The chemical concentration (dbl).}
#' \item{Units}{The units (chr).}
#' \item{Group}{The taxonomic group (fctr).}
#' }
#' @seealso [`ccme_data()`]
#' @family boron
#' @examples
#' head(ccme_data)
"boron_data"

#' Model Averaged Predictions for CCME Boron Data
#'
#' A data frame of the predictions based on 1,000 bootstrap iterations.
Expand Down
10 changes: 0 additions & 10 deletions R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,6 @@ ssd_fit_dists <- function(
chk_not_any_na(dists)
chk_unique(dists)

if ("llog" %in% dists) {
deprecate_stop("0.1.0", "dllog()", "dllogis()",
details = "The 'llog' distribution has been deprecated for the identical 'llogis' distribution."
)
}
if ("burrIII2" %in% dists) {
deprecate_stop("0.1.2", "xburrIII2()",
details = "The 'burrIII2' distribution has been deprecated for the identical 'llogis' distribution."
)
}
chk_subset(dists, ssd_dists_all())

chk_whole_number(nrow)
Expand Down
4 changes: 2 additions & 2 deletions R/ggplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ geom_ssd <- function(mapping = NULL,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE) {
lifecycle::deprecate_soft("0.3.5", "geom_ssd()", "geom_ssdpoint()")
lifecycle::deprecate_warn("0.3.5", "geom_ssd()", "geom_ssdpoint()")

geom_ssdpoint(
mapping = mapping, data = data, stat = stat,
Expand Down Expand Up @@ -232,7 +232,7 @@ stat_ssd <- function(mapping = NULL,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE) {
lifecycle::deprecate_soft("0.3.5", "stat_ssd()")
lifecycle::deprecate_warn("0.3.5", "stat_ssd()")

layer(
stat = StatSsdpoint, data = data, mapping = mapping, geom = geom,
Expand Down
2 changes: 1 addition & 1 deletion R/ggproto.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ GeomXribbon <- ggproto(
ids <- cumsum(missing_pos) + 1
ids[missing_pos] <- NA

positions <- summarise(data,
positions <- plyr::summarise(data,
y = c(y, rev(y)), x = c(xmax, rev(xmin)), id = c(ids, rev(ids))
)
munched <- coord_munch(coord, positions, panel_params)
Expand Down
8 changes: 4 additions & 4 deletions R/gompertz.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @return A numeric vector.
#' @export
dgompertz <- function(x, llocation = 0, lshape = 0, log = FALSE) {
lifecycle::deprecate_soft("1.0.0", "dgompertz()")
lifecycle::deprecate_warn("1.0.0", "dgompertz()")
ddist("gompertz", x,
location = exp(llocation), shape = exp(lshape),
log = log
Expand All @@ -44,7 +44,7 @@ ssd_pgompertz <- function(q, location = 1, shape = 1, lower.tail = TRUE, log.p =
#' `r lifecycle::badge("deprecated")`
#' @export
pgompertz <- function(q, llocation = 0, lshape = 0, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_soft("1.0.0", "pgompertz()", "ssd_pgompertz()")
lifecycle::deprecate_warn("1.0.0", "pgompertz()", "ssd_pgompertz()")
ssd_pgompertz(q,
location = exp(llocation), shape = exp(lshape),
lower.tail = lower.tail, log.p = log.p
Expand All @@ -67,7 +67,7 @@ ssd_qgompertz <- function(p, location = 1, shape = 1, lower.tail = TRUE, log.p =
#' `r lifecycle::badge("deprecated")`
#' @export
qgompertz <- function(p, llocation = 0, lshape = 0, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_soft("1.0.0", "qgompertz()", "ssd_qgompertz()")
lifecycle::deprecate_warn("1.0.0", "qgompertz()", "ssd_qgompertz()")
ssd_qgompertz(
p = p, location = exp(llocation), shape = exp(lshape),
lower.tail = lower.tail, log.p = log.p
Expand All @@ -88,7 +88,7 @@ ssd_rgompertz <- function(n, location = 1, shape = 1, chk = TRUE) {
#' `r lifecycle::badge("deprecated")`
#' @export
rgompertz <- function(n, llocation = 0, lshape = 0) {
lifecycle::deprecate_soft("1.0.0", "rgompertz()", "ssd_rgompertz()")
lifecycle::deprecate_warn("1.0.0", "rgompertz()", "ssd_rgompertz()")
ssd_rgompertz(n = n, location = exp(llocation), shape = exp(lshape))
}

Expand Down
2 changes: 1 addition & 1 deletion R/hc-burrlioz.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
#' @export
ssd_hc_burrlioz <- function(x, percent = 5, ci = FALSE, level = 0.95, nboot = 1000,
min_pboot = 0.99, parametric = FALSE) {
lifecycle::deprecate_soft("0.3.5", "ssd_hc_burrlioz()", "ssd_hc()")
lifecycle::deprecate_warn("0.3.5", "ssd_hc_burrlioz()", "ssd_hc()")
chk_s3_class(x, "fitburrlioz")

ssd_hc(x,
Expand Down
16 changes: 2 additions & 14 deletions R/hc.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#' hazard concentrations(s).
#'
#' @inheritParams params
#' @param hc A whole numeric vector between 1 and 99 indicating the percent hazard concentrations (deprecated for percent).
#' @return A tibble of corresponding hazard concentrations.
#' @seealso [`predict.fitdists()`] and [`ssd_hp()`].
#' @export
Expand Down Expand Up @@ -181,16 +180,12 @@ no_ssd_hc <- function() {

#' @describeIn ssd_hc Hazard Concentrations for Distributional Estimates
#' @export
ssd_hc.list <- function(x, percent = 5, hc = 5, ...) {
ssd_hc.list <- function(x, percent = 5, ...) {
chk_list(x)
chk_named(x)
chk_unique(names(x))
chk_unused(...)

if (!missing(hc)) {
deprecate_stop("0.1.0", "ssd_hc(hc = )", "ssd_hc(percent = )")
}

if (!length(x)) {
return(no_ssd_hc())
}
Expand All @@ -203,16 +198,13 @@ ssd_hc.list <- function(x, percent = 5, hc = 5, ...) {

#' @describeIn ssd_hc Hazard Concentrations for fitdists Object
#' @export
ssd_hc.fitdists <- function(x, percent = 5, hc = 5, ci = FALSE, level = 0.95, nboot = 1000,
ssd_hc.fitdists <- function(x, percent = 5, ci = FALSE, level = 0.95, nboot = 1000,
average = TRUE, delta = 7, min_pboot = 0.99,
parametric = TRUE,
control = NULL, ...) {
chk_vector(percent)
chk_numeric(percent)
chk_range(percent, c(0, 100))
chk_vector(hc)
chk_numeric(hc)
chk_range(hc, c(0, 100))
chk_flag(ci)
chk_number(level)
chk_range(level)
Expand All @@ -227,10 +219,6 @@ ssd_hc.fitdists <- function(x, percent = 5, hc = 5, ci = FALSE, level = 0.95, nb
chk_null_or(control, vld = vld_list)
chk_unused(...)

if (!missing(hc)) {
deprecate_stop("0.1.0", "ssd_hc(hc = )", "ssd_hc(percent = )")
}

x <- subset(x, delta = delta)
hc <- .ssd_hc_fitdists(x, percent,
ci = ci, level = level, nboot = nboot, min_pboot = min_pboot, control = control,
Expand Down
8 changes: 4 additions & 4 deletions R/lgumbel.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' @return A numeric vector.
#' @export
dlgumbel <- function(x, locationlog = 0, scalelog = 1, log = FALSE) {
lifecycle::deprecate_soft("1.0.0", "dlgumbel()")
lifecycle::deprecate_warn("1.0.0", "dlgumbel()")
ddist("gumbel",
x = x, location = locationlog, scale = scalelog,
log = log, .lgt = TRUE
Expand All @@ -44,7 +44,7 @@ ssd_plgumbel <- function(q, locationlog = 0, scalelog = 1, lower.tail = TRUE, lo
#' `r lifecycle::badge("deprecated")`
#' @export
plgumbel <- function(q, locationlog = 0, scalelog = 1, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_soft("1.0.0", "plgumbel()", "ssd_plgumbel()")
lifecycle::deprecate_warn("1.0.0", "plgumbel()", "ssd_plgumbel()")
ssd_plgumbel(q,
locationlog = locationlog, scalelog = scalelog,
lower.tail = lower.tail, log.p = log.p
Expand All @@ -67,7 +67,7 @@ ssd_qlgumbel <- function(p, locationlog = 0, scalelog = 1, lower.tail = TRUE, lo
#' `r lifecycle::badge("deprecated")`
#' @export
qlgumbel <- function(p, locationlog = 0, scalelog = 1, lower.tail = TRUE, log.p = FALSE) {
lifecycle::deprecate_soft("1.0.0", "qlgumbel()", "ssd_qlgumbel()")
lifecycle::deprecate_warn("1.0.0", "qlgumbel()", "ssd_qlgumbel()")
ssd_qlgumbel(p,
locationlog = locationlog, scalelog = scalelog,
lower.tail = lower.tail, log.p = log.p
Expand All @@ -88,7 +88,7 @@ ssd_rlgumbel <- function(n, locationlog = 0, scalelog = 1, chk = TRUE) {
#' `r lifecycle::badge("deprecated")`
#' @export
rlgumbel <- function(n, locationlog = 0, scalelog = 1) {
lifecycle::deprecate_soft("1.0.0", "rlgumbel()", "ssd_rlgumbel()")
lifecycle::deprecate_warn("1.0.0", "rlgumbel()", "ssd_rlgumbel()")
ssd_rlgumbel(n, locationlog = locationlog, scalelog = scalelog)
}

Expand Down
37 changes: 0 additions & 37 deletions R/namespace.R

This file was deleted.

9 changes: 1 addition & 8 deletions R/plot-cf.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ssd_plot_cf <- function(data, left = "Conc") {
err("Package 'fitdistrplus' is required to produce Cullen and Frey plots.")
}

deprecate_soft("0.3.5", "ssd_plot_cf()", "fitdistrplus::descdist()",
lifecycle::deprecate_warn("0.3.5", "ssd_plot_cf()", "fitdistrplus::descdist()",
details = "Please use fitdistrplus::descdist(data$Conc, boot = 100L)."
)

Expand All @@ -40,10 +40,3 @@ ssd_plot_cf <- function(data, left = "Conc") {
fitdistrplus::descdist(data[[left]], boot = 100L)
invisible()
}

#' @describeIn ssd_plot_cf Defunct Cullen and Frey Plot
#' @export
ssd_cfplot <- function(data, left = "Conc") {
deprecate_stop("0.1.0", "ssd_cfplot()", "ssd_plot_cf()")
ssd_plot_cf(data, left)
}
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ graphics::plot

#' @export
plot.fitdists <- function(x, ...) {
lifecycle::deprecate_warn("0.3.4", "plot.fitdists()", "autoplot.fitdists()")
lifecycle::deprecate_stop("0.3.4", "plot.fitdists()", "autoplot.fitdists()")
autoplot(x)
}
26 changes: 26 additions & 0 deletions R/ssdtools-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,29 @@
"_PACKAGE"

utils::globalVariables("where")

## usethis namespace: start
#' @import chk ggplot2
#' @importFrom abind abind
#' @importFrom furrr future_map furrr_options
#' @importFrom generics augment glance tidy
#' @importFrom ggplot2 autoplot sym
#' @importFrom goftest ad.test cvm.test
#' @importFrom graphics par plot title
#' @importFrom grid gList gpar grobName gTree polygonGrob segmentsGrob
#' @importFrom lifecycle expect_deprecated deprecate_soft deprecate_stop deprecate_warn
#' @importFrom parallel nextRNGStream nextRNGSubStream
#' @importFrom plyr summarise
#' @importFrom purrr transpose
#' @importFrom Rcpp sourceCpp
#' @importFrom scales comma manual_pal percent trans_breaks
#' @importFrom ssddata gm_mean
#' @importFrom stats coef complete.cases ks.test logLik nobs optim plogis predict qlogis runif sd setNames weighted.mean
#' @importFrom stringr str_order
#' @importFrom tibble as_tibble tibble
#' @importFrom TMB MakeADFun sdreport
#' @importFrom universals estimates npars
#' @importFrom utils capture.output
#' @importFrom VGAM gompertz vglm
## usethis namespace: end
NULL
4 changes: 2 additions & 2 deletions R/tidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ generics::tidy
est <- unname(x[, 1])
names(est) <- rownames(x)
est <- est[!grepl("^log(it){0,1}_", names(est))]
est[str_order(names(est))]
est[stringr::str_order(names(est))]
}

#' @export
Expand All @@ -44,7 +44,7 @@ tidy.tmbfit <- function(x, all = FALSE, ...) {
if (!all) {
x <- x[!grepl("^log(it){0,1}_", x$term), ]
}
x <- x[str_order(x$term), ]
x <- x[stringr::str_order(x$term), ]
x
}

Expand Down
Loading

0 comments on commit 00ce732

Please sign in to comment.