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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: GWAS
> ### Title: Genome-wide association analysis
> ### Aliases: GWAS
> 
> ### ** Examples
> 
> #random population of 200 lines with 1000 markers
> M <- matrix(rep(0,200*1000),1000,200)
> for (i in 1:200) {
+   M[,i] <- ifelse(runif(1000)<0.5,-1,1)
+ }
> colnames(M) <- 1:200
> geno <- data.frame(marker=1:1000,chrom=rep(1,1000),pos=1:1000,M,check.names=FALSE)
> 
> QTL <- 100*(1:5) #pick 5 QTL
> u <- rep(0,1000) #marker effects
> u[QTL] <- 1
> g <- as.vector(crossprod(M,u))
> h2 <- 0.5
> y <- g + rnorm(200,mean=0,sd=sqrt((1-h2)/h2*var(g)))
> 
> pheno <- data.frame(line=1:200,y=y)
> scores <- GWAS(pheno,geno,plot=FALSE)
[1] "GWAS for trait: y"
[1] "Variance components estimated. Testing markers."
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
rrBLUP
 --- call from context --- 
score.calc(M[ix.pheno, ])
 --- call from argument --- 
if (class(Winv) != "try-error") {
    beta <- Winv %*% crossprod(X3, H2inv %*% y2)
    resid <- y2 - X3 %*% beta
    s2 <- as.double(crossprod(resid, H2inv %*% resid))/v2
    CovBeta <- s2 * Winv
    Fstat <- beta[p]^2/CovBeta[p, p]
    x <- v2/(v2 + v1 * Fstat)
    scores[i] <- -log10(pbeta(x, v2/2, v1/2))
}
 --- R stacktrace ---
where 1: score.calc(M[ix.pheno, ])
where 2: GWAS(pheno, geno, plot = FALSE)

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (M) 
{
    m <- ncol(M)
    scores <- array(0, m)
    for (i in 1:m) {
        Mi <- M[, i]
        freq <- mean(Mi + 1, na.rm = TRUE)/2
        MAF <- min(freq, 1 - freq)
        if (MAF >= min.MAF) {
            not.NA.gid <- which(!is.na(Mi))
            temp <- rep(1, length(Mi))
            temp[not.NA.gid] <- 0
            not.NA.obs <- which(Z %*% temp != 1)
            n2 <- length(not.NA.obs)
            y2 <- matrix(y[not.NA.obs], n2, 1)
            Z2 <- Z[not.NA.obs, not.NA.gid]
            X3 <- cbind(X2[not.NA.obs, ], Z2 %*% Mi[not.NA.gid])
            p <- ncol(X3)
            v1 <- 1
            v2 <- n2 - p
            if (!P3D) {
                H2inv <- mixed.solve(y = y2, X = X3, Z = Z2, 
                  K = K2[not.NA.gid, not.NA.gid], return.Hinv = TRUE)$Hinv
            }
            else {
                H2inv <- Hinv[not.NA.obs, not.NA.obs]
            }
            W <- crossprod(X3, H2inv %*% X3)
            Winv <- try(solve(W), silent = TRUE)
            if (class(Winv) != "try-error") {
                beta <- Winv %*% crossprod(X3, H2inv %*% y2)
                resid <- y2 - X3 %*% beta
                s2 <- as.double(crossprod(resid, H2inv %*% resid))/v2
                CovBeta <- s2 * Winv
                Fstat <- beta[p]^2/CovBeta[p, p]
                x <- v2/(v2 + v1 * Fstat)
                scores[i] <- -log10(pbeta(x, v2/2, v1/2))
            }
        }
    }
    return(scores)
}
<bytecode: 0x56212c28e438>
<environment: 0x56212c278cf8>
 --- function search by body ---
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1