From cd946525c0f749adbc47dac89e1eb31770686fdd Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 31 Aug 2024 11:43:34 +0200 Subject: [PATCH] update --- R/p_direction.R | 8 ++++---- man/bayestestR-package.Rd | 2 +- man/p_direction.Rd | 5 ++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/R/p_direction.R b/R/p_direction.R index 97b0b5d78..f1f5b8389 100644 --- a/R/p_direction.R +++ b/R/p_direction.R @@ -182,16 +182,16 @@ p_direction.data.frame <- function(x, method = "direct", null = 0, rvar_col = NU return(.p_direction_df(x, method = method, null = null, ...)) } - stopifnot(length(rvar_col) == 1L, - is.character(rvar_col), - rvar_col %in% colnames(x)) - + if (length(rvar_col) != 1L && !rvar_col %in% colnames(x)) { + insight::format_error("The `rvar_col` argument must be a single, valid column name.") + } out <- p_direction(x[[rvar_col]], method = method, null = null, ...) x[["pd"]] <- out[["pd"]] x } + #' @keywords internal .p_direction_df <- function(x, method = "direct", null = 0, ...) { obj_name <- insight::safe_deparse_symbol(substitute(x)) diff --git a/man/bayestestR-package.Rd b/man/bayestestR-package.Rd index 56aac0235..3552e5bdb 100644 --- a/man/bayestestR-package.Rd +++ b/man/bayestestR-package.Rd @@ -40,7 +40,7 @@ Authors: \item Daniel Lüdecke \email{d.luedecke@uke.de} (\href{https://orcid.org/0000-0002-8895-3206}{ORCID}) (@strengejacke) \item Mattan S. Ben-Shachar \email{matanshm@post.bgu.ac.il} (\href{https://orcid.org/0000-0002-4287-4801}{ORCID}) (@mattansb) \item Indrajeet Patil \email{patilindrajeet.science@gmail.com} (\href{https://orcid.org/0000-0003-1995-6531}{ORCID}) (@patilindrajeets) - \item Michael D. Wilson \email{michael.d.wilson@curtin.edu.au} (\href{https://orcid.org/0000-0003-4143-7308}{ORCID}) + \item Micah K. Wilson \email{micah.k.wilson@curtin.edu.au} (\href{https://orcid.org/0000-0003-4143-7308}{ORCID}) \item Brenton M. Wiernik \email{brenton@wiernik.org} (\href{https://orcid.org/0000-0001-9560-6336}{ORCID}) (@bmwiernik) } diff --git a/man/p_direction.Rd b/man/p_direction.Rd index e87ff6ee9..ec07597bd 100644 --- a/man/p_direction.Rd +++ b/man/p_direction.Rd @@ -19,7 +19,7 @@ pd(x, ...) \method{p_direction}{numeric}(x, method = "direct", null = 0, ...) -\method{p_direction}{data.frame}(x, method = "direct", null = 0, ...) +\method{p_direction}{data.frame}(x, method = "direct", null = 0, rvar_col = NULL, ...) \method{p_direction}{MCMCglmm}(x, method = "direct", null = 0, ...) @@ -69,6 +69,9 @@ such as \code{"kernel"}, \code{"logspline"} or \code{"KernSmooth"}. See details. \item{null}{The value considered as a "null" effect. Traditionally 0, but could also be 1 in the case of ratios of change (OR, IRR, ...).} +\item{rvar_col}{Name of an \code{rvar}-type column. If \code{NULL}, each column in the +data frame is assumed to represent draws from a posterior distribution.} + \item{effects}{Should results for fixed effects, random effects or both be returned? Only applies to mixed models. May be abbreviated.}