Skip to content

Commit

Permalink
get rid of unnecessary data checks
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-buerkner committed Sep 16, 2016
1 parent f65a79d commit bf094d5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 1 addition & 3 deletions R/make_stancode.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ make_stancode <- function(formula, data = NULL, family = gaussian(),
sample_prior <- use_alias(sample_prior, dots$sample.prior)
save_model <- use_alias(save_model, dots$save.model)
dots[c("cov.ranef", "sample.prior", "save.model")] <- NULL
# some input checks
if (!(is.null(data) || is.list(data)))
stop("argument 'data' must be a data.frame or list", call. = FALSE)
# some input checks
family <- check_family(family)
formula <- update_formula(formula, data = data, family = family,
partial = partial, nonlinear = nonlinear)
Expand Down
4 changes: 1 addition & 3 deletions R/make_standata.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ make_standata <- function(formula, data = NULL, family = "gaussian",
is_newdata <- isTRUE(control$is_newdata)
# use deprecated arguments if specified
cov_ranef <- use_alias(cov_ranef, dots$cov.ranef, warn = FALSE)
# some input checks
if (!(is.null(data) || is.list(data)))
stop("argument 'data' must be a data.frame or list", call. = FALSE)
# some input checks
family <- check_family(family)
formula <- update_formula(formula, data = data, family = family,
partial = partial, nonlinear = nonlinear)
Expand Down
2 changes: 0 additions & 2 deletions R/priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,6 @@ get_prior <- function(formula, data = NULL, family = gaussian(),
threshold = c("flexible", "equidistant"),
internal = FALSE) {
# note that default priors are stored in this function
if (!(is.null(data) || is.list(data)))
stop("argument 'data' must be a data.frame or list", call. = FALSE)
family <- check_family(family)
link <- family$link
formula <- update_formula(formula, data = data, family = family,
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/tests.make_standata.R
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ test_that("make_standata returns data for bsts models", {
dat <- data.frame(y = 1:5, g = c(1:3, sample(1:3, 2, TRUE)), t = 1:5)
expect_equal(make_standata(y~1, data = dat, autocor = cor_bsts(~t|g))$tg,
sort(dat$g))
expect_equal(make_standata(bf(y~1, sigma ~ 1), data = dat,
autocor = cor_bsts(~t|g))$X_sigma[, 1],
rep(1, seq_len(nrow(dat))))
expect_equivalent(make_standata(bf(y~1, sigma ~ 1), data = dat,
autocor = cor_bsts(~t|g))$X_sigma[, 1],
rep(1, nrow(dat)))
})

test_that("make_standata returns data for GAMMs", {
Expand Down

0 comments on commit bf094d5

Please sign in to comment.