From 6288bcad1c4e6b8a55109622f5240d355f0cc06e Mon Sep 17 00:00:00 2001 From: mitchelloharawild Date: Tue, 17 Sep 2024 01:09:24 +1000 Subject: [PATCH] Check fixes --- R/generate.R | 2 +- R/plot.R | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/R/generate.R b/R/generate.R index bfcc1019..002a3483 100644 --- a/R/generate.R +++ b/R/generate.R @@ -129,7 +129,7 @@ Does your model require extra variables to produce simulations?", e$message)) .sim } -block_bootstrap <- function (n, window_size, size = length(x)) { +block_bootstrap <- function (n, window_size, size = n) { n_blocks <- size%/%window_size + 2 bx <- numeric(n_blocks * window_size) for (i in seq_len(n_blocks)) { diff --git a/R/plot.R b/R/plot.R index f3265fda..ecbf46fa 100644 --- a/R/plot.R +++ b/R/plot.R @@ -342,7 +342,12 @@ build_fbl_layer <- function(object, data = NULL, level = c(80, 95), if (!na.rm && anyNA(x)) { return(matrix(c(NA_real_, NA_real_), ncol = 2)) } - do.call(rbind, lapply(quantile(x, (1 + c(-1, 1) * .width)/2, type = "marginal", na.rm = na.rm), t)) + + if (packageVersion("distributional") > "0.4.0") { + do.call(rbind, lapply(quantile(x, (1 + c(-1, 1) * .width)/2, type = "marginal", na.rm = na.rm), t)) + } else { + do.call(rbind, lapply(quantile(x, (1 + c(-1, 1) * .width)/2, na.rm = na.rm), t)) + } } dist_qi_frame <- function(data, level) {