Skip to content

Commit 5e51826

Browse files
committed
trying fixing R cmd check NOTE
1 parent ea8df35 commit 5e51826

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

R/helpers-mcmc.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ prepare_mcmc_array <- function(x,
5151
if (is.matrix(x)) {
5252
x <- x[, pars, drop=FALSE]
5353
if (length(transformations)) {
54-
x <- apply_transformations(x, transformations)
54+
x <- apply_transformations(x, transformations = transformations)
5555
}
5656
x <- array(x, dim = c(nrow(x), 1, ncol(x)))
5757
} else {
5858
x <- x[, , pars, drop = FALSE]
5959
if (length(transformations)) {
60-
x <- apply_transformations(x, transformations)
60+
x <- apply_transformations(x, transformations = transformations)
6161
}
6262
}
6363

@@ -388,10 +388,10 @@ validate_transformations <-
388388
#' functions.
389389
#' @return x, with tranformations having been applied to some parameters.
390390
#'
391-
apply_transformations <- function(x, transformations = list(), ...) {
391+
apply_transformations <- function(x, ...) {
392392
UseMethod("apply_transformations")
393393
}
394-
apply_transformations.matrix <- function(x, transformations = list()) {
394+
apply_transformations.matrix <- function(x, ..., transformations = list()) {
395395
pars <- colnames(x)
396396
x_transforms <- validate_transformations(transformations, pars)
397397
for (p in names(x_transforms)) {
@@ -400,7 +400,7 @@ apply_transformations.matrix <- function(x, transformations = list()) {
400400

401401
x
402402
}
403-
apply_transformations.array <- function(x, transformations = list()) {
403+
apply_transformations.array <- function(x, ..., transformations = list()) {
404404
stopifnot(length(dim(x)) == 3)
405405
pars <- dimnames(x)[[3]]
406406
x_transforms <- validate_transformations(transformations, pars)

R/mcmc-diagnostics.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,17 +360,17 @@ mcmc_acf_bar <-
360360
#' `x <= breaks[1]`, `breaks[1] < x <= breaks[2]`, `x > breaks[2]`).
361361
#' @return A factor the same length as `x` with three levels.
362362
#' @noRd
363-
diagnostic_factor <- function(x, breaks, ...) {
363+
diagnostic_factor <- function(x, ...) {
364364
UseMethod("diagnostic_factor")
365365
}
366366

367-
diagnostic_factor.rhat <- function(x, breaks = c(1.05, 1.1)) {
367+
diagnostic_factor.rhat <- function(x, ..., breaks = c(1.05, 1.1)) {
368368
cut(x, breaks = c(-Inf, breaks, Inf),
369369
labels = c("low", "ok", "high"),
370370
ordered_result = FALSE)
371371
}
372372

373-
diagnostic_factor.neff_ratio <- function(x, breaks = c(0.1, 0.5)) {
373+
diagnostic_factor.neff_ratio <- function(x, ..., breaks = c(0.1, 0.5)) {
374374
cut(x, breaks = c(-Inf, breaks, Inf),
375375
labels = c("low", "ok", "high"),
376376
ordered_result = FALSE)

tests/testthat/test-helpers-mcmc.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ test_that("validate_transformations throws correct errors", {
193193
test_that("apply_transformations works", {
194194
trans <- list('beta[1]' = "exp", sigma = function(x) x^2)
195195

196-
arr_trans <- apply_transformations(arr, trans)
196+
arr_trans <- apply_transformations(arr, transformations = trans)
197197
expect_equal(arr_trans[,, "sigma"], arr[,, "sigma"]^2)
198198
expect_equal(arr_trans[,, "beta[1]"], exp(arr[,, "beta[1]"]))
199199

200-
mat_trans <- apply_transformations(mat, trans)
200+
mat_trans <- apply_transformations(mat, transformations = trans)
201201
expect_equal(mat_trans[, "sigma"], mat[, "sigma"]^2)
202202
expect_equal(mat_trans[, "beta[1]"], exp(mat[, "beta[1]"]))
203203
})

vignettes/visual-mcmc-diagnostics.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ schools_mod_ncp <- stan_model("schools_mod_ncp.stan")
154154
We then fit the model by calling Stan's MCMC algorithm using the `sampling`
155155
function (the increased `adapt_delta` param is to make the sampler a bit more "careful" and avoid false positive divergences),
156156
```{r fit-models-hidden, results='hide', message=FALSE}
157-
fit_cp <- sampling(schools_mod_cp, data = schools_dat, seed = 803214054, control = list(adapt_delta = 0.9))
157+
fit_cp <- sampling(schools_mod_cp, data = schools_dat, seed = 803214055, control = list(adapt_delta = 0.9))
158158
fit_ncp <- sampling(schools_mod_ncp, data = schools_dat, seed = 457721433, control = list(adapt_delta = 0.9))
159159
```
160160
and extract a `iterations x chains x parameters` array of posterior draws with

0 commit comments

Comments
 (0)