Running examples in ‘swamp-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: adjust.linearmodel
> ### Title: Batch adjustment using a linear model
> ### Aliases: adjust.linearmodel
> ### Keywords: design
> 
> ### ** Examples
> 
> # data as a matrix
> set.seed(100)
> g<-matrix(nrow=1000,ncol=50,rnorm(1000*50),dimnames=list(paste("Feature",1:1000),
+    paste("Sample",1:50)))
> g[1:100,26:50]<-g[1:100,26:50]+1 # the first 100 features show
> # higher values in the samples 26:50
> # patient annotations as a data.frame, annotations should be numbers and factors
> # but not characters.
> # rownames have to be the same as colnames of the data matrix 
> set.seed(200)
> o<-data.frame(Factor1=factor(c(rep("A",25),rep("B",25))),
+               Factor2=factor(rep(c("A","B"),25)),
+               Numeric1=rnorm(50), Numeric2=colMeans(g),row.names=colnames(g))
> 
> ##unadjusted.data
> res1<-prince(g,o,top=10)
> prince.plot(res1)
> 
> ##batch adjustment
> lin1<-adjust.linearmodel(g,o$Numeric2)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
swamp
 --- call from context --- 
adjust.linearmodel(g, o$Numeric2)
 --- call from argument --- 
if (class(g) != "matrix") {
    stop("g is not a matrix")
}
 --- R stacktrace ---
where 1: adjust.linearmodel(g, o$Numeric2)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (g, o.batches, robust.lm = F, small.memory = F) 
{
    if (class(g) != "matrix") {
        stop("g is not a matrix")
    }
    if (nrow(data.frame(o.batches)) != ncol(g)) {
        stop("o.batches has not the same number of samples as ncol(g)")
    }
    if (!is.data.frame(o.batches)) {
        o.batches <- data.frame(o.batches, row.names = colnames(g))
    }
    naing <- sum(apply(g, 2, function(x) sum(is.na(x))))
    gc()
    if (naing > 0) {
        stop("No NAs in g are allowed for adjust.linearmodel")
    }
    nas <- apply(o.batches, 1, function(x) sum(is.na(x)))
    index <- which(nas == 0)
    gafter <- matrix(nrow = nrow(g), ncol = ncol(g), dimnames = dimnames(g))
    if (length(which(nas > 0)) > 0) {
        gafter[, which(nas > 0)] <- g[, which(nas > 0)]
        warning(paste("Samples", toString(which(nas > 0)), "are not adjusted because of NAs in o.batches"))
    }
    if (robust.lm == F) {
        if (small.memory == F) {
            fit1 <- lm(t(g) ~ ., o.batches)
            gafter[, index] = t(fit1$residuals)
        }
        else {
            for (i in 1:nrow(g)) {
                gafter[i, index] <- lm(g[i, ] ~ ., o.batches)$residuals
            }
        }
    }
    else {
        for (i in 1:nrow(g)) {
            gafter[i, index] <- rlm(g[i, ] ~ ., o.batches)$residuals
        }
    }
    rowm <- rowMeans(g[, index])
    gc()
    gafter[, index] <- gafter[, index] + rowm
    gc()
    return(gafter)
}
<bytecode: 0x55ffc93f4920>
<environment: namespace:swamp>
 --- function search by body ---
Function adjust.linearmodel in namespace swamp has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1