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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: speccl
> ### Title: A spectral clustering algorithm
> ### Aliases: speccl
> ### Keywords: spectral clustering cluster analysis scales of measurement
> 
> ### ** Examples
> 
> # Commented due to long execution time
> # Example 1
> #library(clusterSim)
> #library(mlbench)
> #data<-mlbench.spirals(100,1,0.03)
> #plot(data)
> #x<-data$x
> #res1<-speccl(x,nc=2,distance="GDM1",sigma="automatic",
> #sigma.interval="default",mod.sample=0.75,R=10,iterations=3)
> #clas1<-res1$cluster
> #print(data$classes)
> #print(clas1)
> #cRand<-classAgreement(table(as.numeric(as.vector(data$classes)),
> #res1$clusters))$crand
> #print(res1$sigma)
> #print(cRand)
> 
> # Example 2
> #library(clusterSim)
> #grnd2<-cluster.Gen(50,model=4,dataType="m",numNoisyVar=1)
> #data<-as.matrix(grnd2$data)
> #colornames<-c("red","blue","green")
> #grnd2$clusters[grnd2$clusters==0]<-length(colornames)
> #plot(grnd2$data,col=colornames[grnd2$clusters])
> #us<-nrow(data)*nrow(data)/2
> #res2<-speccl(data,nc=3,distance="sEuclidean",sigma="automatic",
> #sigma.interval=us,mod.sample=0.75,R=10,iterations=3)
> #cRand<-comparing.Partitions(grnd2$clusters,res2$clusters,type="crand")
> #print(res2$sigma)
> #print(cRand)
> 
> # Example 3
> #library(clusterSim)
> #grnd3<-cluster.Gen(40,model=4,dataType="o",numCategories=7)
> #data<-as.matrix(grnd3$data)
> #plotCategorial(grnd3$data,pairsofVar=NULL,cl=grnd3$clusters,
> #clColors=c("red","blue","green"))
> #res3<-speccl(data,nc=3,distance="GDM2",sigma="automatic",
> #sigma.interval="default",mod.sample=0.75,R=10,iterations=3)
> #cRand<-comparing.Partitions(grnd3$clusters,res3$clusters,type="crand")
> #print(res3$sigma)
> #print(cRand)
> 
> # Example 4
> library(clusterSim)
> data(data_nominal)
> res4<-speccl(data_nominal,nc=4,distance="SM",sigma="automatic",
+ sigma.interval="default",mod.sample=0.75,R=10,iterations=3)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
clusterSim
 --- call from context --- 
speccl(data_nominal, nc = 4, distance = "SM", sigma = "automatic", 
    sigma.interval = "default", mod.sample = 0.75, R = 10, iterations = 3)
 --- call from argument --- 
if (class(ei) != "try-error") {
    if (!is.null(ei) && is.numeric(ei)) {
        yi <- try(ei/sqrt(rowSums(ei^2)), silent = silDebug)
        if (sum(is.na(yi)) == 0) {
            res <- try(kmeans(yi, yi[initial.Centers(yi, nc), 
                ], ...), silent = silDebug)
            if (class(res) == "try-error") {
                res <- list(withinss = 1e+10)
                next
            }
            if (sum(res$withinss) < sigWithinss || sigWithinss == 
                -1) {
                ok <- TRUE
                sig <- sigma
                sigWithinss <- sum(res$withinss)
            }
        }
        i <- i + 1
    }
    else {
        na.action(ei)
    }
} else {
}
 --- R stacktrace ---
where 1: speccl(data_nominal, nc = 4, distance = "SM", sigma = "automatic", 
    sigma.interval = "default", mod.sample = 0.75, R = 10, iterations = 3)

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (data, nc, distance = "GDM1", sigma = "automatic", sigma.interval = "default", 
    mod.sample = 0.75, R = 10, iterations = 3, na.action = na.omit, 
    ...) 
{
    if (sigma == "automatic") {
        sigmaSimulation <- TRUE
    }
    else {
        sigmaSimulation <- FALSE
        sigma <- as.numeric(sigma)
    }
    DEBUG <- FALSE
    globalOk <- FALSE
    silDebug = TRUE
    badSigma <- NULL
    tries <- 0
    while (!globalOk) {
        step <- 0
        sigWithinss <- -1
        ok <- FALSE
        while (!ok && step < 6) {
            step <- step + 1
            x <- data
            bootstrap <- x[sample(1:nrow(x), nrow(x) * mod.sample), 
                ]
            levelsPower <- R
            levels <- iterations
            lstart <- 0
            lend <- sum(.ddist(x, distance))
            if (distance == "sEuclidean") {
                lend <- sqrt(lend)
            }
            if (sigma.interval != "default") {
                lend <- sigma.interval
            }
            lby <- lend
            lstartend <- lend
            sig <- sample(1:lstartend, 1)
            if (sigmaSimulation) {
                for (ll in levels:1) {
                  lby <- lby/levelsPower
                  sigmas <- (seq(lstart, lend - lby, by = lby) + 
                    seq(lstart + lby, lend, by = lby))/2
                  oldsigma <- sig
                  i <- 0
                  for (sigma in sigmas) {
                    if (distance == "GDM1" || distance == "GDM2") {
                      ka <- .GDMKernel(as.matrix(dist.GDM(bootstrap, 
                        method = distance)), sigma)
                    }
                    else if (distance == "BC") {
                      ka <- .GausKernel(as.matrix(dist.BC(bootstrap)), 
                        sigma)
                    }
                    else if (distance == "SM") {
                      ka <- .GausKernel(as.matrix(dist.SM(bootstrap)), 
                        sigma)
                    }
                    else if (distance == "sEuclidean") {
                      ka <- .GausKernel(as.matrix(dist(bootstrap))^2, 
                        sigma)
                    }
                    else {
                      dd <- try(dist(bootstrap, method = distance), 
                        silent = silDebug)
                      if (class(dd) == "try-error") {
                        dd <- try(dist.binary(bootstrap, method = distance), 
                          silent = silDebug)
                      }
                      if (class(dd) == "try-error") {
                        stop(paste("unknown distance method ", 
                          distance))
                      }
                      ka <- .GausKernel(as.matrix(dd), sigma)
                    }
                    d <- 1/sqrt(rowSums(ka))
                    l <- d * ka %*% diag(d)
                    ei <- NULL
                    tf <- function(l, nc) {
                      eigen(l, symmetric = TRUE)$vectors[, 1:nc]
                    }
                    ei <- try(tf(l, nc), silent = silDebug)
                    if (class(ei) != "try-error") {
                      if (!is.null(ei) && is.numeric(ei)) {
                        yi <- try(ei/sqrt(rowSums(ei^2)), silent = silDebug)
                        if (sum(is.na(yi)) == 0) {
                          res <- try(kmeans(yi, yi[initial.Centers(yi, 
                            nc), ], ...), silent = silDebug)
                          if (class(res) == "try-error") {
                            res <- list(withinss = 1e+10)
                            next
                          }
                          if (sum(res$withinss) < sigWithinss || 
                            sigWithinss == -1) {
                            ok <- TRUE
                            sig <- sigma
                            sigWithinss <- sum(res$withinss)
                          }
                        }
                        i <- i + 1
                      }
                      else {
                        na.action(ei)
                      }
                    }
                    else {
                    }
                  }
                  if (is.null(sig) || (!is.null(oldsigma) && 
                    oldsigma == sig)) {
                    lstart <- lstart/R
                    lend <- lend/R
                  }
                  else {
                    lstart <- sig - 0.5 * lby
                    lend <- sig + 0.5 * lby
                  }
                }
            }
            else {
                ok <- TRUE
                sig <- as.numeric(sigma)
            }
        }
        if (step >= 6) {
            sig <- sample(1:lstartend, 1)
            if (distance == "manhattan") 
                sig <- sample(1:10, 1)
        }
        if (!is.null(badSigma)) {
            for (ss in badSigma) {
                if (abs(sig - ss) < 0.5) {
                  sig <- sample(1:lstartend, 1)
                  if (distance == "manhattan") 
                    sig <- sample(1:10, 1)
                }
            }
        }
        globalOk <- TRUE
        if (distance == "GDM1" || distance == "GDM2") {
            scdist <- dist.GDM(x, method = distance)
            km <- .GDMKernel(as.matrix(scdist), sig)
        }
        else if (distance == "BC") {
            scdist <- dist.BC(x)
            km <- .GausKernel(as.matrix(scdist), sig)
        }
        else if (distance == "SM") {
            scdist <- dist.SM(x)
            km <- .GausKernel(as.matrix(scdist), sig)
        }
        else if (distance == "sEuclidean") {
            scdist <- dist(x)^2
            km <- .GausKernel(as.matrix(scdist), sig)
        }
        else {
            scdist <- try(dist(x, method = distance), silent = silDebug)
            if (class(dd) == "try-error") {
                scdist <- try(dist.binary(x, method = distance), 
                  silent = silDebug)
            }
            if (class(scdist) == "try-error") {
                stop(paste("unknown distance method ", distance))
                globalOk <- FALSE
            }
            km <- .GausKernel(as.matrix(scdist), sig)
        }
        diag(km) <- 0
        d <- 1/sqrt(rowSums(km))
        l <- d * km %*% diag(d)
        if (getRversion() >= "3.0") {
            ei <- try(eigen(l, symmetric = T)$vectors[, 1:nc], 
                silent = silDebug)
        }
        else {
            ei <- try(eigen(l)$vectors[, 1:nc], silent = silDebug)
        }
        if (class(ei) == "try-error") {
            globalOk <- FALSE
        }
        if (globalOk) {
            yi <- ei/sqrt(rowSums(ei^2))
        }
        if (globalOk) {
            res <- try(kmeans(yi, yi[initial.Centers(yi, nc), 
                ], ...), silent = silDebug)
            if (class(res) == "try-error") {
                res <- try(kmeans(yi, nc, ...), silent = silDebug)
            }
        }
        if (globalOk && class(res) == "try-error") {
            if (is.character(all.equal(na.action, na.omit))) {
                tries <- tries + 1
                if (tries < 5) {
                  stop(paste("Not possible to do clustering, try with other distance type - ", 
                    distance))
                }
            }
            globalOk <- FALSE
        }
        if (!globalOk) {
            badSigma <- c(badSigma, sig)
        }
    }
    return(list(clusters = res$cluster, size = res$size, withinss = res$withins, 
        sigma = sig, Ematrix = ei, Ymatrix = yi, scdist = scdist))
}
<bytecode: 0x5638472b1598>
<environment: namespace:clusterSim>
 --- function search by body ---
Function speccl in namespace clusterSim has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1