Skip to content

Commit

Permalink
styler
Browse files Browse the repository at this point in the history
[skip]
  • Loading branch information
mattansb committed Sep 5, 2024
1 parent d67146f commit 3d5ccf2
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 18 deletions.
7 changes: 4 additions & 3 deletions R/bayesfactor_restricted.R
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,10 @@ bayesfactor_restricted.data.frame <- function(posterior, hypothesis, prior = NUL
#' @export
bayesfactor_restricted.draws <- function(posterior, hypothesis, prior = NULL, ...) {
bayesfactor_restricted(.posterior_draws_to_df(posterior),
hypothesis = hypothesis,
prior = if (!is.null(prior)) .posterior_draws_to_df(prior),
...)
hypothesis = hypothesis,
prior = if (!is.null(prior)) .posterior_draws_to_df(prior),
...
)
}

#' @export
Expand Down
16 changes: 11 additions & 5 deletions R/describe_posterior.R
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,17 @@ describe_posterior.default <- function(posterior, ...) {
dot_args <- list(...)
dot_args$verbose <- !"rope" %in% test
test_equi <- .prepare_output(
do.call(equivalence_test,
c(dot_args,
list(x = x_df,
range = rope_range,
ci = rope_ci))),
do.call(
equivalence_test,
c(
dot_args,
list(
x = x_df,
range = rope_range,
ci = rope_ci
)
)
),
cleaned_parameters,
is_stanmvreg
)
Expand Down
1 change: 0 additions & 1 deletion R/equivalence_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ equivalence_test.numeric <- function(x, range = "default", ci = 0.95, verbose =
#' @inheritParams p_direction
#' @export
equivalence_test.data.frame <- function(x, range = "default", ci = 0.95, rvar_col = NULL, verbose = TRUE, ...) {

obj_name <- insight::safe_deparse_symbol(substitute(x))

if (length(x_rvar <- .possibly_extract_rvar_col(x, rvar_col)) > 0L) {
Expand Down
1 change: 0 additions & 1 deletion R/estimate_density.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ estimate_density.data.frame <- function(x,
at = NULL,
rvar_col = NULL,
...) {

if (length(x_rvar <- .possibly_extract_rvar_col(x, rvar_col)) > 0L) {
cl <- match.call()
cl[[1]] <- bayestestR::estimate_density
Expand Down
1 change: 0 additions & 1 deletion R/rope.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ rope.get_predicted <- function(x,
#' @rdname rope
#' @inheritParams p_direction
rope.data.frame <- function(x, range = "default", ci = 0.95, ci_method = "ETI", rvar_col = NULL, verbose = TRUE, ...) {

obj_name <- insight::safe_deparse_symbol(substitute(x))

if (length(x_rvar <- .possibly_extract_rvar_col(x, rvar_col)) > 0L) {
Expand Down
5 changes: 3 additions & 2 deletions R/si.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ si.data.frame <- function(posterior, prior = NULL, BF = 1, rvar_col = NULL, verb
#' @export
si.draws <- function(posterior, prior = NULL, BF = 1, verbose = TRUE, ...) {
si(.posterior_draws_to_df(posterior),
prior = if (!is.null(prior)) .posterior_draws_to_df(prior),
BF = BF, verbose = verbose, ...)
prior = if (!is.null(prior)) .posterior_draws_to_df(prior),
BF = BF, verbose = verbose, ...
)
}

#' @export
Expand Down
10 changes: 5 additions & 5 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@

is_rvar <- vapply(object, function(col) inherits(col, "rvar"), FUN.VALUE = logical(1))
grid_names <- colnames(object)[!is_rvar]
grid <- data.frame(object[,grid_names,drop = FALSE])
grid <- data.frame(object[, grid_names, drop = FALSE])

if (long) {
grid$Parameter <- unique(results$Parameter)
Expand Down Expand Up @@ -263,11 +263,11 @@
}

if (is.character(rvar_col) &&
length(rvar_col) == 1L &&
rvar_col %in% colnames(df) &&
inherits(df[[rvar_col]], "rvar")) {
length(rvar_col) == 1L &&
rvar_col %in% colnames(df) &&
inherits(df[[rvar_col]], "rvar")) {
return(df[[rvar_col]])
}

insight::format_error("The `rvar_col` argument must be a single, valid column name.")
}
}

0 comments on commit 3d5ccf2

Please sign in to comment.