Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions R/commonPower.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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))) {
Expand All @@ -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)
Expand Down Expand Up @@ -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) {
Expand All @@ -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)
Expand Down