diff --git a/R/lefser.R b/R/lefser.R index 29bc3ce..e3928e8 100644 --- a/R/lefser.R +++ b/R/lefser.R @@ -169,9 +169,11 @@ filterKruskal <- function(relab, group, p.value, method = method) { #' when 'blockCol' is present (default 0.05). If multiple hypothesis testing is #' performed, this threshold is applied to corrected p-values. #' @param lda.threshold numeric(1) The effect size threshold (default 2.0). +#' #' @param groupCol character(1) Column name in `colData(relab)` indicating -#' groups, usually a factor with two levels (e.g., `c("cases", "controls")`; -#' default "GROUP"). +#' groups, usually a factor with two or more levels (e.g., +#' `c("cases", "controls")`; default `"GROUP"`). +#' #' @param blockCol character(1) Optional column name in `colData(relab)` #' indicating the blocks, usually a factor with two levels (e.g., #' `c("adult", "senior")`; default NULL). @@ -253,10 +255,8 @@ lefser <- groupf <- colData(relab)[[groupCol]] groupf <- as.factor(groupf) lgroupf <- levels(groupf) - if (is.null(groupf) || !identical(length(lgroupf), 2L)) { - msg <- "'groupCol' must refer to a valid dichotomous (two-level) variable" - stop(msg) # ensure the class has only two levels - } + if (is.null(groupf) || length(lgroupf) < 2L) + stop("'groupCol' must be a valid two or more level variable") message( "The outcome variable is specified as '", groupCol, "' and the reference category is '", lgroupf[1], diff --git a/man/lefser.Rd b/man/lefser.Rd index 895e148..ad04f1b 100644 --- a/man/lefser.Rd +++ b/man/lefser.Rd @@ -34,8 +34,8 @@ performed, this threshold is applied to corrected p-values.} \item{lda.threshold}{numeric(1) The effect size threshold (default 2.0).} \item{groupCol}{character(1) Column name in \code{colData(relab)} indicating -groups, usually a factor with two levels (e.g., \code{c("cases", "controls")}; -default "GROUP").} +groups, usually a factor with two or more levels (e.g., +\code{c("cases", "controls")}; default \code{"GROUP"}).} \item{blockCol}{character(1) Optional column name in \code{colData(relab)} indicating the blocks, usually a factor with two levels (e.g.,