In the function Krig.check.xY:
if (na.rm) {
ind <- is.na(Y)
if(all(ind)){
stop("Oops! All Y values are missing!")
}
if (any(ind)) {
Y <- Y[!ind]
x <- as.matrix(x[!ind, ])
if (!is.null(Z)) {
Z <- Z[!ind, ] <-----------------
}
weights <- weights[!ind]
}
}
In the function Krig.replicates:
else {
rep.info.aov <- fast.1way(rep.info, out$y, out$weights)
tauHat.pure.error <- sqrt(rep.info.aov$MSE)
tauHat.rep <- tauHat.pure.error
yM <- as.matrix(rep.info.aov$means)
weightsM <- rep.info.aov$w.means
xM <- as.matrix(out$x[uniquerows, ])
if (!is.null(out$Z)) {
ZM <- as.matrix(out$Z[uniquerows, ]) <-----------------
}
else {
ZM <- NULL
}
pure.ss <- rep.info.aov$SSE
if (verbose)
print(rep.info.aov)
}
Krig.check.xY may return Z as a vector, which will trigger error of Krig.replicates, because Z is not a matrix.
A simple solution is Z[!ind, , drop = FALSE]
In the function
Krig.check.xY:In the function
Krig.replicates:Krig.check.xYmay return Z as a vector, which will trigger error ofKrig.replicates, becauseZis not a matrix.A simple solution is
Z[!ind, , drop = FALSE]