Running ‘testthat.R’ [8s/12s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(funcy)
  Loading required package: flexclust
  Loading required package: grid
  Loading required package: lattice
  Loading required package: modeltools
  Loading required package: stats4
  Loading required package: splines
  > 
  > test_check("funcy")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  funcy
   --- call from context --- 
  funcit(methods = methods, data = ds@data, k = k, clusters = ds@clusters, 
      seed = 2405, save.data = TRUE, parallel = parallel)
   --- call from argument --- 
  if (!(class(data) %in% c("matrix", "data.frame"))) stop(paste(data, 
      "must be given in matrix or data.frame format."))
   --- R stacktrace ---
  where 1: funcit(methods = methods, data = ds@data, k = k, clusters = ds@clusters, 
      seed = 2405, save.data = TRUE, parallel = parallel)
  where 2: eval(expr, pf)
  where 3: eval(expr, pf)
  where 4: withVisible(eval(expr, pf))
  where 5: evalVis(expr)
  where 6 at testthat/test-old-unit-tests.R#7: capture.output(result <- expr)
  where 7 at testthat/test-old-unit-tests.R#22: silent(funcit(methods = methods, data = ds@data, k = k, clusters = ds@clusters, 
      seed = 2405, save.data = TRUE, parallel = parallel))
  where 8: eval(code, test_env)
  where 9: eval(code, test_env)
  where 10: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 16: tryCatchList(expr, classes, parentenv, handlers)
  where 17: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 18: test_code(desc, code, env = parent.frame())
  where 19 at testthat/test-old-unit-tests.R#20: test_that("All Cluster algorithms work", {
      res1 <- silent(funcit(methods = methods, data = ds@data, 
          k = k, clusters = ds@clusters, seed = 2405, save.data = TRUE, 
          parallel = parallel))
  })
  where 20: eval(code, test_env)
  where 21: eval(code, test_env)
  where 22: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 26: doTryCatch(return(expr), name, parentenv, handler)
  where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 28: tryCatchList(expr, classes, parentenv, handlers)
  where 29: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 30: test_code(NULL, exprs, env)
  where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 32: force(code)
  where 33: doWithOneRestart(return(expr), restart)
  where 34: withOneRestart(expr, restarts[[1L]])
  where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 36: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 37: FUN(X[[i]], ...)
  where 38: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 39: force(code)
  where 40: doWithOneRestart(return(expr), restart)
  where 41: withOneRestart(expr, restarts[[1L]])
  where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 43: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 45: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 46: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 47: test_check("funcy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (data, k, methods = c("fitfclust", "distclust", "iterSubspace", 
      "funclust", "funHDDC", "fscm", "waveclust"), seed = NULL, 
      regTime = NULL, clusters = NULL, funcyCtrl = NULL, fpcCtrl = NULL, 
      parallel = FALSE, save.data = TRUE, ...) 
  {
      if (missing(methods)) 
          stop("Please select one method or methods='ALL'.")
      else if (length(methods) == 1) 
          if (methods == "ALL") 
              methods <- 1:7
      allMethods <- c("fitfclust", "distclust", "iterSubspace", 
          "funclust", "funHDDC", "fscm", "waveclust")
      if (is.numeric(methods)) 
          usedMethods <- allMethods[methods]
      else usedMethods <- match.arg(methods, allMethods, several.ok = TRUE)
      nrMethods <- length(usedMethods)
      if (missing(k)) 
          stop(paste(k, "is missing"))
      if (!(class(data) %in% c("matrix", "data.frame"))) 
          stop(paste(data, "must be given in matrix or data.frame format."))
      chf <- checkFormat(data)
      data <- chf$data
      reg <- chf$reg
      if (is.null(funcyCtrl)) 
          funcyCtrl <- new("funcyCtrl")
      funcyCtrl@seed <- seed
      if (sum(usedMethods %in% allMethods[c(1, 3, 4, 5, 6, 7)]) > 
          0 & class(funcyCtrl) == "funcyCtrl") 
          funcyCtrl <- as(funcyCtrl, "funcyCtrlMbc")
      if (funcyCtrl@baseType != "eigenbasis" & !is.null(fpcCtrl)) 
          warning("fpcCtrl is ignored since it controls only eigenbasis.")
      else if (funcyCtrl@baseType == "eigenbasis") 
          fpcCtrl <- fpcCtrlCheck(fpcCtrl = fpcCtrl, data = data, 
              reg = reg)
      if (reg == 0 & sum(usedMethods %in% c("fscm", "funclust", 
          "funHDDC")) > 0) {
          notWork <- usedMethods[which(usedMethods %in% allMethods[-c(1:3)])]
          stop(paste("Algorithm", notWork, "works only on regular data!\n Please choose one of fitfclust, distclust or iterSubspace."))
      }
      if (nrMethods == 1) 
          parallel <- FALSE
      if (.Platform$OS.type != "unix" & parallel) {
          warning("Parallel computing is only supported on Unix platforms.")
          parallel <- FALSE
      }
      if (parallel) {
          parallelFct <- parallel::mcparallel
          coresNr <- detectCores() - 1
          options(cores = coresNr)
      }
      else {
          parallelFct <- identity
      }
      RES <- list()
      if ("fitfclust" %in% usedMethods) {
          indx <- match("fitfclust", usedMethods)
          RES[[indx]] <- parallelFct(fitfclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrlMbc = funcyCtrl, ...))
      }
      if ("distclust" %in% usedMethods) {
          indx <- match("distclust", usedMethods)
          RES[[indx]] <- parallelFct(distclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrl = funcyCtrl, ...))
      }
      if ("iterSubspace" %in% usedMethods) {
          indx <- match("iterSubspace", usedMethods)
          RES[[indx]] <- parallelFct(iterSubspaceWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrlMbc = funcyCtrl, ...))
      }
      if ("funclust" %in% usedMethods) {
          .warn_once <- local({
              not.warned.yet <- TRUE
              function(x) {
                  if (not.warned.yet) {
                    warning("Funclustering is currently not available on CRAN.")
                    not.warned.yet <<- FALSE
                  }
              }
          })
      }
      if ("funHDDC" %in% usedMethods) {
          if (!requireNamespace("funHDDC")) 
              stop("Please install package 'funHDDC' to use method 'funHDDC'.")
          indx <- match("funHDDC", usedMethods)
          RES[[indx]] <- parallelFct(funHDDCWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      if ("fscm" %in% usedMethods) {
          indx <- match("fscm", usedMethods)
          RES[[indx]] <- parallelFct(fscmWrapper(data = data, k = k, 
              reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      if ("waveclust" %in% usedMethods) {
          indx <- match("waveclust", usedMethods)
          RES[[indx]] <- parallelFct(waveclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      FRES <- new("funcyOutList")
      FRES@call <- match.call()
      if (parallel) 
          FRES@models <- parallel::mccollect(RES)
      else FRES@models <- RES
      names(FRES@models) <- usedMethods
      error <- which(sapply(FRES@models, class) == "try-error")
      if (sum(error) != 0) 
          stop(paste("Method", usedMethods[error[1]], ":", attributes(FRES@models[[error[1]]])$condition$message))
      allClusters <- sapply(FRES@models, function(x) x@cluster)
      allCenters <- lapply(FRES@models, function(x) x@centers)
      names(allCenters) <- colnames(allClusters) <- usedMethods
      rI <- rIMethods(methodNames = usedMethods, cls = allClusters, 
          trueCluster = clusters)
      if (nrMethods > 1) {
          rel <- relabelMethods(methodNames = usedMethods, cls = allClusters, 
              ctrs = allCenters)
          allClusters <- rel$allClusters
          allCenters <- rel$allCenters
          for (i in 1:nrMethods) {
              FRES@models[[i]]@cluster <- allClusters[, i]
              FRES@models[[i]]@centers <- allCenters[[i]]
              FRES@models[[i]]@correctCl <- rI[i, i]
          }
      }
      smallCl <- which(apply(allClusters, 2, function(x) min(table(x))) < 
          2)
      if (length(smallCl) != 0) {
          warning(paste("Method", usedMethods[smallCl], "has clusters with less than 3 obervations!\n"), 
              immediate. = TRUE)
      }
      accord <- accordance(cls = allClusters, relabel = FALSE)
      if (save.data) 
          FRES@data <- data
      else FRES@data <- as.matrix(NULL)
      FRES@timeNr <- calcTimeNr(data, reg)
      FRES@reg <- reg
      FRES@k <- k
      FRES@methodName <- usedMethods
      FRES@allClusters <- allClusters
      FRES@randIndex <- rI
      FRES@votedCluster <- accord$votedCluster
      FRES@accordance <- accord$accordance
      return(FRES)
  }
  <bytecode: 0x55e1ce9f2d30>
  <environment: namespace:funcy>
   --- function search by body ---
  Function funcit in namespace funcy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  ── 1. Error: All Cluster algorithms work (@test-old-unit-tests.R#22)  ──────────
  the condition has length > 1
  Backtrace:
   1. funcy:::silent(...)
   7. funcy::funcit(...)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  funcy
   --- call from context --- 
  funcit(methods = methods, seed = 2506, data = data, k = 4)
   --- call from argument --- 
  if (!(class(data) %in% c("matrix", "data.frame"))) stop(paste(data, 
      "must be given in matrix or data.frame format."))
   --- R stacktrace ---
  where 1: funcit(methods = methods, seed = 2506, data = data, k = 4)
  where 2: eval(expr, pf)
  where 3: eval(expr, pf)
  where 4: withVisible(eval(expr, pf))
  where 5: evalVis(expr)
  where 6 at testthat/test-old-unit-tests.R#7: capture.output(result <- expr)
  where 7 at testthat/test-old-unit-tests.R#46: silent(funcit(methods = methods, seed = 2506, data = data, k = 4))
  where 8: eval(code, test_env)
  where 9: eval(code, test_env)
  where 10: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 16: tryCatchList(expr, classes, parentenv, handlers)
  where 17: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 18: test_code(desc, code, env = parent.frame())
  where 19 at testthat/test-old-unit-tests.R#36: test_that("Making an irregular data set regular", {
      data <- expect_silent(regFuncy(ds@data, timeNr = 10, nbasis = 5, 
          method = "interpolate"))
      data <- expect_silent(regFuncy(ds@data, baseType = "splines", 
          timeNr = 10, nbasis = 10, method = "project")$data)
      res2 <- silent(funcit(methods = methods, seed = 2506, data = data, 
          k = 4))
      cl <- lapply(res2@models, class)
      expected <- structure(c("funcyOutMbc-fitfclust", "funcyOut", 
          "funcyOut-iterSubspace", "funcyOutMbc", "funcyOutMbc-fscm", 
          "funcyOutMbc"), .Names = c("fitfclust", "distclust", 
          "iterSubspace", "funHDDC", "fscm", "waveclust"))
      expect_equal(object = unlist(cl), expected = expected)
  })
  where 20: eval(code, test_env)
  where 21: eval(code, test_env)
  where 22: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 26: doTryCatch(return(expr), name, parentenv, handler)
  where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 28: tryCatchList(expr, classes, parentenv, handlers)
  where 29: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 30: test_code(NULL, exprs, env)
  where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 32: force(code)
  where 33: doWithOneRestart(return(expr), restart)
  where 34: withOneRestart(expr, restarts[[1L]])
  where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 36: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 37: FUN(X[[i]], ...)
  where 38: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 39: force(code)
  where 40: doWithOneRestart(return(expr), restart)
  where 41: withOneRestart(expr, restarts[[1L]])
  where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 43: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 45: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 46: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 47: test_check("funcy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (data, k, methods = c("fitfclust", "distclust", "iterSubspace", 
      "funclust", "funHDDC", "fscm", "waveclust"), seed = NULL, 
      regTime = NULL, clusters = NULL, funcyCtrl = NULL, fpcCtrl = NULL, 
      parallel = FALSE, save.data = TRUE, ...) 
  {
      if (missing(methods)) 
          stop("Please select one method or methods='ALL'.")
      else if (length(methods) == 1) 
          if (methods == "ALL") 
              methods <- 1:7
      allMethods <- c("fitfclust", "distclust", "iterSubspace", 
          "funclust", "funHDDC", "fscm", "waveclust")
      if (is.numeric(methods)) 
          usedMethods <- allMethods[methods]
      else usedMethods <- match.arg(methods, allMethods, several.ok = TRUE)
      nrMethods <- length(usedMethods)
      if (missing(k)) 
          stop(paste(k, "is missing"))
      if (!(class(data) %in% c("matrix", "data.frame"))) 
          stop(paste(data, "must be given in matrix or data.frame format."))
      chf <- checkFormat(data)
      data <- chf$data
      reg <- chf$reg
      if (is.null(funcyCtrl)) 
          funcyCtrl <- new("funcyCtrl")
      funcyCtrl@seed <- seed
      if (sum(usedMethods %in% allMethods[c(1, 3, 4, 5, 6, 7)]) > 
          0 & class(funcyCtrl) == "funcyCtrl") 
          funcyCtrl <- as(funcyCtrl, "funcyCtrlMbc")
      if (funcyCtrl@baseType != "eigenbasis" & !is.null(fpcCtrl)) 
          warning("fpcCtrl is ignored since it controls only eigenbasis.")
      else if (funcyCtrl@baseType == "eigenbasis") 
          fpcCtrl <- fpcCtrlCheck(fpcCtrl = fpcCtrl, data = data, 
              reg = reg)
      if (reg == 0 & sum(usedMethods %in% c("fscm", "funclust", 
          "funHDDC")) > 0) {
          notWork <- usedMethods[which(usedMethods %in% allMethods[-c(1:3)])]
          stop(paste("Algorithm", notWork, "works only on regular data!\n Please choose one of fitfclust, distclust or iterSubspace."))
      }
      if (nrMethods == 1) 
          parallel <- FALSE
      if (.Platform$OS.type != "unix" & parallel) {
          warning("Parallel computing is only supported on Unix platforms.")
          parallel <- FALSE
      }
      if (parallel) {
          parallelFct <- parallel::mcparallel
          coresNr <- detectCores() - 1
          options(cores = coresNr)
      }
      else {
          parallelFct <- identity
      }
      RES <- list()
      if ("fitfclust" %in% usedMethods) {
          indx <- match("fitfclust", usedMethods)
          RES[[indx]] <- parallelFct(fitfclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrlMbc = funcyCtrl, ...))
      }
      if ("distclust" %in% usedMethods) {
          indx <- match("distclust", usedMethods)
          RES[[indx]] <- parallelFct(distclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrl = funcyCtrl, ...))
      }
      if ("iterSubspace" %in% usedMethods) {
          indx <- match("iterSubspace", usedMethods)
          RES[[indx]] <- parallelFct(iterSubspaceWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrlMbc = funcyCtrl, ...))
      }
      if ("funclust" %in% usedMethods) {
          .warn_once <- local({
              not.warned.yet <- TRUE
              function(x) {
                  if (not.warned.yet) {
                    warning("Funclustering is currently not available on CRAN.")
                    not.warned.yet <<- FALSE
                  }
              }
          })
      }
      if ("funHDDC" %in% usedMethods) {
          if (!requireNamespace("funHDDC")) 
              stop("Please install package 'funHDDC' to use method 'funHDDC'.")
          indx <- match("funHDDC", usedMethods)
          RES[[indx]] <- parallelFct(funHDDCWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      if ("fscm" %in% usedMethods) {
          indx <- match("fscm", usedMethods)
          RES[[indx]] <- parallelFct(fscmWrapper(data = data, k = k, 
              reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      if ("waveclust" %in% usedMethods) {
          indx <- match("waveclust", usedMethods)
          RES[[indx]] <- parallelFct(waveclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      FRES <- new("funcyOutList")
      FRES@call <- match.call()
      if (parallel) 
          FRES@models <- parallel::mccollect(RES)
      else FRES@models <- RES
      names(FRES@models) <- usedMethods
      error <- which(sapply(FRES@models, class) == "try-error")
      if (sum(error) != 0) 
          stop(paste("Method", usedMethods[error[1]], ":", attributes(FRES@models[[error[1]]])$condition$message))
      allClusters <- sapply(FRES@models, function(x) x@cluster)
      allCenters <- lapply(FRES@models, function(x) x@centers)
      names(allCenters) <- colnames(allClusters) <- usedMethods
      rI <- rIMethods(methodNames = usedMethods, cls = allClusters, 
          trueCluster = clusters)
      if (nrMethods > 1) {
          rel <- relabelMethods(methodNames = usedMethods, cls = allClusters, 
              ctrs = allCenters)
          allClusters <- rel$allClusters
          allCenters <- rel$allCenters
          for (i in 1:nrMethods) {
              FRES@models[[i]]@cluster <- allClusters[, i]
              FRES@models[[i]]@centers <- allCenters[[i]]
              FRES@models[[i]]@correctCl <- rI[i, i]
          }
      }
      smallCl <- which(apply(allClusters, 2, function(x) min(table(x))) < 
          2)
      if (length(smallCl) != 0) {
          warning(paste("Method", usedMethods[smallCl], "has clusters with less than 3 obervations!\n"), 
              immediate. = TRUE)
      }
      accord <- accordance(cls = allClusters, relabel = FALSE)
      if (save.data) 
          FRES@data <- data
      else FRES@data <- as.matrix(NULL)
      FRES@timeNr <- calcTimeNr(data, reg)
      FRES@reg <- reg
      FRES@k <- k
      FRES@methodName <- usedMethods
      FRES@allClusters <- allClusters
      FRES@randIndex <- rI
      FRES@votedCluster <- accord$votedCluster
      FRES@accordance <- accord$accordance
      return(FRES)
  }
  <bytecode: 0x55e1ce9f2d30>
  <environment: namespace:funcy>
   --- function search by body ---
  Function funcit in namespace funcy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  ── 2. Error: Making an irregular data set regular (@test-old-unit-tests.R#46)  ─
  the condition has length > 1
  Backtrace:
   1. funcy:::silent(...)
   7. funcy::funcit(methods = methods, seed = 2506, data = data, k = 4)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  funcy
   --- call from context --- 
  funcit(methods = c(1, 2, 3), data = ds@data, k = k, clusters = ds@clusters, 
      fpcCtrl = fpcCtrl, funcyCtrl = funcyCtrlMbc, save.data = TRUE, 
      parallel = parallel)
   --- call from argument --- 
  if (!(class(data) %in% c("matrix", "data.frame"))) stop(paste(data, 
      "must be given in matrix or data.frame format."))
   --- R stacktrace ---
  where 1: funcit(methods = c(1, 2, 3), data = ds@data, k = k, clusters = ds@clusters, 
      fpcCtrl = fpcCtrl, funcyCtrl = funcyCtrlMbc, save.data = TRUE, 
      parallel = parallel)
  where 2: eval(expr, pf)
  where 3: eval(expr, pf)
  where 4: withVisible(eval(expr, pf))
  where 5: evalVis(expr)
  where 6 at testthat/test-old-unit-tests.R#7: capture.output(result <- expr)
  where 7 at testthat/test-old-unit-tests.R#76: silent(funcit(methods = c(1, 2, 3), data = ds@data, k = k, clusters = ds@clusters, 
      fpcCtrl = fpcCtrl, funcyCtrl = funcyCtrlMbc, save.data = TRUE, 
      parallel = parallel))
  where 8: eval(code, test_env)
  where 9: eval(code, test_env)
  where 10: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 16: tryCatchList(expr, classes, parentenv, handlers)
  where 17: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 18: test_code(desc, code, env = parent.frame())
  where 19 at testthat/test-old-unit-tests.R#65: test_that("Test control arguments", {
      k <- 4
      set.seed(3806)
      ds <- sampleFuncy(timeNrMin = 5, timeNrMax = 10, reg = FALSE, 
          k = k, sd = 0.3)
      a <- list(coeffsCalc = "estimate", average = TRUE)
      fpcCtrl <- as(a, "fpcCtrl")
      b <- list(maxit = 5, baseType = "eigenbasis", flexDim = TRUE)
      funcyCtrlMbc <- as(b, "funcyCtrlMbc")
      res3 <- silent(funcit(methods = c(1, 2, 3), data = ds@data, 
          k = k, clusters = ds@clusters, fpcCtrl = fpcCtrl, funcyCtrl = funcyCtrlMbc, 
          save.data = TRUE, parallel = parallel))
  })
  where 20: eval(code, test_env)
  where 21: eval(code, test_env)
  where 22: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 26: doTryCatch(return(expr), name, parentenv, handler)
  where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 28: tryCatchList(expr, classes, parentenv, handlers)
  where 29: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 30: test_code(NULL, exprs, env)
  where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 32: force(code)
  where 33: doWithOneRestart(return(expr), restart)
  where 34: withOneRestart(expr, restarts[[1L]])
  where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 36: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 37: FUN(X[[i]], ...)
  where 38: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 39: force(code)
  where 40: doWithOneRestart(return(expr), restart)
  where 41: withOneRestart(expr, restarts[[1L]])
  where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 43: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 45: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 46: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 47: test_check("funcy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (data, k, methods = c("fitfclust", "distclust", "iterSubspace", 
      "funclust", "funHDDC", "fscm", "waveclust"), seed = NULL, 
      regTime = NULL, clusters = NULL, funcyCtrl = NULL, fpcCtrl = NULL, 
      parallel = FALSE, save.data = TRUE, ...) 
  {
      if (missing(methods)) 
          stop("Please select one method or methods='ALL'.")
      else if (length(methods) == 1) 
          if (methods == "ALL") 
              methods <- 1:7
      allMethods <- c("fitfclust", "distclust", "iterSubspace", 
          "funclust", "funHDDC", "fscm", "waveclust")
      if (is.numeric(methods)) 
          usedMethods <- allMethods[methods]
      else usedMethods <- match.arg(methods, allMethods, several.ok = TRUE)
      nrMethods <- length(usedMethods)
      if (missing(k)) 
          stop(paste(k, "is missing"))
      if (!(class(data) %in% c("matrix", "data.frame"))) 
          stop(paste(data, "must be given in matrix or data.frame format."))
      chf <- checkFormat(data)
      data <- chf$data
      reg <- chf$reg
      if (is.null(funcyCtrl)) 
          funcyCtrl <- new("funcyCtrl")
      funcyCtrl@seed <- seed
      if (sum(usedMethods %in% allMethods[c(1, 3, 4, 5, 6, 7)]) > 
          0 & class(funcyCtrl) == "funcyCtrl") 
          funcyCtrl <- as(funcyCtrl, "funcyCtrlMbc")
      if (funcyCtrl@baseType != "eigenbasis" & !is.null(fpcCtrl)) 
          warning("fpcCtrl is ignored since it controls only eigenbasis.")
      else if (funcyCtrl@baseType == "eigenbasis") 
          fpcCtrl <- fpcCtrlCheck(fpcCtrl = fpcCtrl, data = data, 
              reg = reg)
      if (reg == 0 & sum(usedMethods %in% c("fscm", "funclust", 
          "funHDDC")) > 0) {
          notWork <- usedMethods[which(usedMethods %in% allMethods[-c(1:3)])]
          stop(paste("Algorithm", notWork, "works only on regular data!\n Please choose one of fitfclust, distclust or iterSubspace."))
      }
      if (nrMethods == 1) 
          parallel <- FALSE
      if (.Platform$OS.type != "unix" & parallel) {
          warning("Parallel computing is only supported on Unix platforms.")
          parallel <- FALSE
      }
      if (parallel) {
          parallelFct <- parallel::mcparallel
          coresNr <- detectCores() - 1
          options(cores = coresNr)
      }
      else {
          parallelFct <- identity
      }
      RES <- list()
      if ("fitfclust" %in% usedMethods) {
          indx <- match("fitfclust", usedMethods)
          RES[[indx]] <- parallelFct(fitfclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrlMbc = funcyCtrl, ...))
      }
      if ("distclust" %in% usedMethods) {
          indx <- match("distclust", usedMethods)
          RES[[indx]] <- parallelFct(distclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrl = funcyCtrl, ...))
      }
      if ("iterSubspace" %in% usedMethods) {
          indx <- match("iterSubspace", usedMethods)
          RES[[indx]] <- parallelFct(iterSubspaceWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, fpcCtrl = fpcCtrl, 
              funcyCtrlMbc = funcyCtrl, ...))
      }
      if ("funclust" %in% usedMethods) {
          .warn_once <- local({
              not.warned.yet <- TRUE
              function(x) {
                  if (not.warned.yet) {
                    warning("Funclustering is currently not available on CRAN.")
                    not.warned.yet <<- FALSE
                  }
              }
          })
      }
      if ("funHDDC" %in% usedMethods) {
          if (!requireNamespace("funHDDC")) 
              stop("Please install package 'funHDDC' to use method 'funHDDC'.")
          indx <- match("funHDDC", usedMethods)
          RES[[indx]] <- parallelFct(funHDDCWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      if ("fscm" %in% usedMethods) {
          indx <- match("fscm", usedMethods)
          RES[[indx]] <- parallelFct(fscmWrapper(data = data, k = k, 
              reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      if ("waveclust" %in% usedMethods) {
          indx <- match("waveclust", usedMethods)
          RES[[indx]] <- parallelFct(waveclustWrapper(data = data, 
              k = k, reg = reg, regTime = regTime, funcyCtrlMbc = funcyCtrl, 
              ...))
      }
      FRES <- new("funcyOutList")
      FRES@call <- match.call()
      if (parallel) 
          FRES@models <- parallel::mccollect(RES)
      else FRES@models <- RES
      names(FRES@models) <- usedMethods
      error <- which(sapply(FRES@models, class) == "try-error")
      if (sum(error) != 0) 
          stop(paste("Method", usedMethods[error[1]], ":", attributes(FRES@models[[error[1]]])$condition$message))
      allClusters <- sapply(FRES@models, function(x) x@cluster)
      allCenters <- lapply(FRES@models, function(x) x@centers)
      names(allCenters) <- colnames(allClusters) <- usedMethods
      rI <- rIMethods(methodNames = usedMethods, cls = allClusters, 
          trueCluster = clusters)
      if (nrMethods > 1) {
          rel <- relabelMethods(methodNames = usedMethods, cls = allClusters, 
              ctrs = allCenters)
          allClusters <- rel$allClusters
          allCenters <- rel$allCenters
          for (i in 1:nrMethods) {
              FRES@models[[i]]@cluster <- allClusters[, i]
              FRES@models[[i]]@centers <- allCenters[[i]]
              FRES@models[[i]]@correctCl <- rI[i, i]
          }
      }
      smallCl <- which(apply(allClusters, 2, function(x) min(table(x))) < 
          2)
      if (length(smallCl) != 0) {
          warning(paste("Method", usedMethods[smallCl], "has clusters with less than 3 obervations!\n"), 
              immediate. = TRUE)
      }
      accord <- accordance(cls = allClusters, relabel = FALSE)
      if (save.data) 
          FRES@data <- data
      else FRES@data <- as.matrix(NULL)
      FRES@timeNr <- calcTimeNr(data, reg)
      FRES@reg <- reg
      FRES@k <- k
      FRES@methodName <- usedMethods
      FRES@allClusters <- allClusters
      FRES@randIndex <- rI
      FRES@votedCluster <- accord$votedCluster
      FRES@accordance <- accord$accordance
      return(FRES)
  }
  <bytecode: 0x55e1ce9f2d30>
  <environment: namespace:funcy>
   --- function search by body ---
  Function funcit in namespace funcy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  ── 3. Error: Test control arguments (@test-old-unit-tests.R#76)  ───────────────
  the condition has length > 1
  Backtrace:
   1. funcy:::silent(...)
   7. funcy::funcit(...)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  [ OK: 2 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 3 ]
  1. Error: All Cluster algorithms work (@test-old-unit-tests.R#22) 
  2. Error: Making an irregular data set regular (@test-old-unit-tests.R#46) 
  3. Error: Test control arguments (@test-old-unit-tests.R#76) 
  
  Error: testthat unit tests failed
  Execution halted