Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# bayesplot (development version)

* Standardize input validation errors in `ppc_km_overlay()` and interpolation helpers to use `rlang::abort()` for consistent error handling.
* Fix assignment-in-call bug in `mcmc_rank_ecdf()` (#).
* Replaced deprecated `dplyr` and `tidyselect` functions (`top_n`, `one_of`, `group_indices`) with their modern equivalents to ensure future compatibility. (#431)
* Documentation added for all exported `*_data()` functions (#209)
Expand Down
10 changes: 5 additions & 5 deletions R/helpers-ppc.R
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ interpolate_gamma <- function(N, K, prob, L) {
get_interpolation_values <- function(N, K, L, prob) {
for (dim in c("L", "prob")) {
if (all(get(dim) != .gamma_adj[, dim])) {
stop(paste(
abort(paste(
"No precomputed values to interpolate from for '", dim, "' = ",
get(dim),
".\n",
Expand All @@ -469,7 +469,7 @@ get_interpolation_values <- function(N, K, L, prob) {
}
vals <- .gamma_adj[.gamma_adj$L == L & .gamma_adj$prob == prob, ]
if (N > max(vals$N)) {
stop(paste(
abort(paste(
"No precomputed values to interpolate from for sample length of ",
N,
".\n",
Expand All @@ -480,7 +480,7 @@ get_interpolation_values <- function(N, K, L, prob) {
))
}
if (N < min(vals$N)) {
stop(paste(
abort(paste(
"No precomputed values to interpolate from for sample length of ",
N,
".\n",
Expand All @@ -491,7 +491,7 @@ get_interpolation_values <- function(N, K, L, prob) {
))
}
if (K > max(vals[vals$N <= N, ]$K)) {
stop(paste(
abort(paste(
"No precomputed values available for interpolation for 'K' = ",
K,
".\n",
Expand All @@ -502,7 +502,7 @@ get_interpolation_values <- function(N, K, L, prob) {
))
}
if (K < min(vals[vals$N <= N, ]$K)) {
stop(paste(
abort(paste(
"No precomputed values available for interpolation for 'K' = ",
K,
".\n",
Expand Down
6 changes: 3 additions & 3 deletions R/ppc-censoring.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ ppc_km_overlay <- function(
suggested_package("ggfortify")

if (!is.numeric(status_y) || length(status_y) != length(y) || !all(status_y %in% c(0, 1))) {
stop("`status_y` must be a numeric vector of 0s and 1s the same length as `y`.", call. = FALSE)
abort("`status_y` must be a numeric vector of 0s and 1s the same length as `y`.")
}

if (!is.null(left_truncation_y)) {
if (!is.numeric(left_truncation_y) || length(left_truncation_y) != length(y)) {
stop("`left_truncation_y` must be a numeric vector of the same length as `y`.", call. = FALSE)
abort("`left_truncation_y` must be a numeric vector of the same length as `y`.")
}
}

if (extrapolation_factor < 1) {
stop("`extrapolation_factor` must be greater than or equal to 1.", call. = FALSE)
abort("`extrapolation_factor` must be greater than or equal to 1.")
}
if (extrapolation_factor == 1.2) {
message(
Expand Down
Loading