Running examples in 'predkmeans-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: predictionMetrics
> ### Title: Measures of Prediction Performance
> ### Aliases: predictionMetrics
> 
> ### ** Examples
> 
> n <- 100
> d <- 5 # Dimension of exposure
> K <- 3 # Number of clusters
> X <- matrix(rnorm(n*d), ncol=d, nrow=n)
> centers <- matrix(runif(d*K), nrow=K, ncol=d)
> cluster_pred <- sample(1:K, size=n, replace=TRUE)
> metrics <- predictionMetrics(centers, cluster.pred=cluster_pred, X=X)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
predkmeans
 --- call from context --- 
predictionMetrics(centers, cluster.pred = cluster_pred, X = X)
 --- call from argument --- 
if (class(X) != "matrix") X <- as.matrix(X)
 --- R stacktrace ---
where 1: predictionMetrics(centers, cluster.pred = cluster_pred, X = X)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (centers, cluster.pred, X, labels = TRUE) 
{
    if (class(X) != "matrix") 
        X <- as.matrix(X)
    if (class(centers) != "matrix") 
        centers <- as.matrix(centers)
    if (ncol(centers) != ncol(X)) 
        stop("Number of columns in 'centers' and 'X' should be the same.")
    if (length(cluster.pred) != nrow(X)) 
        stop("Length of cluster.pred should equal number of rows in X.")
    K <- nrow(centers)
    if (any(!unique(cluster.pred) %in% c(1:K, rownames(centers)))) 
        stop("cluster.pred must be integers within 1 to K or row names of 'centers'.")
    cluster.assign <- assignCluster(X, centers = centers)
    pred.acc <- mean(cluster.pred == cluster.assign)
    MSME <- sum((centers[cluster.pred, ] - centers[cluster.assign, 
        ])^2)/nrow(X)
    wSS <- sum((X - centers[cluster.assign, ])^2)/nrow(X)
    MSPE <- sum((X - centers[cluster.pred, ])^2)/nrow(X)
    if (labels) {
        res <- list(MSPE = MSPE, wSS = wSS, MSME = MSME, pred.acc = pred.acc, 
            cluster.pred = cluster.pred, cluster.assign = cluster.assign)
    }
    else {
        res <- list(MSPE = MSPE, wSS = wSS, MSME = MSME, pred.acc = pred.acc)
    }
    res
}
<bytecode: 0xe4587d8>
<environment: namespace:predkmeans>
 --- function search by body ---
Function predictionMetrics in namespace predkmeans has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1