Skip to content

Commit bf094d5

Browse files
committed
get rid of unnecessary data checks
1 parent f65a79d commit bf094d5

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

R/make_stancode.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ make_stancode <- function(formula, data = NULL, family = gaussian(),
3030
sample_prior <- use_alias(sample_prior, dots$sample.prior)
3131
save_model <- use_alias(save_model, dots$save.model)
3232
dots[c("cov.ranef", "sample.prior", "save.model")] <- NULL
33-
# some input checks
34-
if (!(is.null(data) || is.list(data)))
35-
stop("argument 'data' must be a data.frame or list", call. = FALSE)
33+
# some input checks
3634
family <- check_family(family)
3735
formula <- update_formula(formula, data = data, family = family,
3836
partial = partial, nonlinear = nonlinear)

R/make_standata.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ make_standata <- function(formula, data = NULL, family = "gaussian",
4040
is_newdata <- isTRUE(control$is_newdata)
4141
# use deprecated arguments if specified
4242
cov_ranef <- use_alias(cov_ranef, dots$cov.ranef, warn = FALSE)
43-
# some input checks
44-
if (!(is.null(data) || is.list(data)))
45-
stop("argument 'data' must be a data.frame or list", call. = FALSE)
43+
# some input checks
4644
family <- check_family(family)
4745
formula <- update_formula(formula, data = data, family = family,
4846
partial = partial, nonlinear = nonlinear)

R/priors.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,6 @@ get_prior <- function(formula, data = NULL, family = gaussian(),
383383
threshold = c("flexible", "equidistant"),
384384
internal = FALSE) {
385385
# note that default priors are stored in this function
386-
if (!(is.null(data) || is.list(data)))
387-
stop("argument 'data' must be a data.frame or list", call. = FALSE)
388386
family <- check_family(family)
389387
link <- family$link
390388
formula <- update_formula(formula, data = data, family = family,

tests/testthat/tests.make_standata.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ test_that("make_standata returns data for bsts models", {
341341
dat <- data.frame(y = 1:5, g = c(1:3, sample(1:3, 2, TRUE)), t = 1:5)
342342
expect_equal(make_standata(y~1, data = dat, autocor = cor_bsts(~t|g))$tg,
343343
sort(dat$g))
344-
expect_equal(make_standata(bf(y~1, sigma ~ 1), data = dat,
345-
autocor = cor_bsts(~t|g))$X_sigma[, 1],
346-
rep(1, seq_len(nrow(dat))))
344+
expect_equivalent(make_standata(bf(y~1, sigma ~ 1), data = dat,
345+
autocor = cor_bsts(~t|g))$X_sigma[, 1],
346+
rep(1, nrow(dat)))
347347
})
348348

349349
test_that("make_standata returns data for GAMMs", {

0 commit comments

Comments
 (0)