diff --git a/R/commonPower.R b/R/commonPower.R index cb1a269..28ee896 100644 --- a/R/commonPower.R +++ b/R/commonPower.R @@ -212,7 +212,7 @@ if (sum(sapply(list(p, n, power, sig.level), is.null)) != 1) { stop("exactly one of p, n, power, and sig.level must be NULL") } - if (!is.null(n) && n < 2) { + if (!is.null(n) && any(n < 2)) { stop("number of observations in the first group must be at least 2") } if (!is.null(sig.level) && (!is.numeric(sig.level) || any(0 > sig.level | sig.level > 1))) { @@ -292,7 +292,7 @@ stop("exactly one of p1, n, n.ratio, power, and sig.level must be NULL") } - if (!is.null(n) && n < 2) { + if (!is.null(n) && any(n < 2)) { stop("number of observations in the first group must be at least 2") } if (!is.null(n.ratio) && n.ratio <= 0) { @@ -383,7 +383,7 @@ stop("exactly one of rho, n, power, and sig.level must be NULL") } - if (!is.null(n) && n < 2) { + if (!is.null(n) && any(n < 2)) { stop("number of observations in the first group must be at least 2") } if (!is.null(sig.level) && (!is.numeric(sig.level) || any(0 > sig.level | sig.level > 1))) { @@ -392,7 +392,7 @@ if (!is.null(power) && (!is.numeric(power) || any(0 > power | power > 1))) { stop("power must be between 0 and 1") } - if (!is.null(rho) && 0 > rho) { + if (!is.null(rho) && any(0 > rho)) { stop("rho must be positive") } alternative <- match.arg(alternative) @@ -470,7 +470,7 @@ stop("exactly one of rho, n, n.ratio, power, and sig.level must be NULL") } - if (!is.null(n) && n < 2) { + if (!is.null(n) && any(n < 2)) { stop("number of observations in the first group must be at least 2") } if (!is.null(n.ratio) && n.ratio <= 0) { @@ -482,7 +482,7 @@ if (!is.null(power) && (!is.numeric(power) || any(0 > power | power > 1))) { stop("power must be between 0 and 1") } - if (!is.null(rho) && 0 > rho) { + if (!is.null(rho) && any(0 > rho)) { stop("rho must be positive") } alternative <- match.arg(alternative)