Running ‘testthat.R’ [19s/28s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(netdiffuseR)
  
  Attaching package: 'netdiffuseR'
  
  The following object is masked from 'package:base':
  
      %*%
  
  > 
  > Sys.setenv("R_TESTS" = "")
  > 
  > test_check("netdiffuseR", reporter = "summary")
  Read/Write graphs edgelist to adjmat and vice-versa: ....1.2
  Bass Diffusion model: ...
  Network bootstrap: ........
  Cumulative adopt count, and hazard rate: ....
  Degree function: .................
  Diffnet class and methods: ................W...........
  Checking diffnet-indexing: ................
  plot_diffnet, threshold, and exposure: ........
  Threshold functions: .............
  Infectiousness and susceptibility (plot methods): ..........
  Other methods: ..................................
  Egonets: ..3....
  Foreign function: ........
  Diffusion Regression: ....
  Graph objects: .............W..
  Silly tests for imports.R: .
  Infection and susceptibility: ................
  Mentor matching: .4
  Misc functions: .5
  Morans I: .
  C++ extra functions: ...
  Testing package .onLoad and options: ....
  Set of functions used in: plot_diffnet2: ........
  Random graphs: ................
  Random diffusion graphs:  ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  netdiffuseR
   --- call from context --- 
  rdiffnet_check_seed_graph(seed.graph, rgraph.args, t, n)
   --- call from argument --- 
  if (test %in% c("matrix", "dgCMatrix", "array")) {
      if ("array" %in% test) 
          sgraph <- apply(seed.graph, 3, function(x) methods::as(x, 
              "dgCMatrix"))
      else sgraph <- methods::as(seed.graph, "dgCMatrix")
  } else if ("list" %in% test) {
      sgraph <- seed.graph
  } else if ("diffnet" %in% test) {
      sgraph <- seed.graph$graph
  } else stop("Invalid argument for -seed.graph-. No support for objects of class -", 
      test, "-.")
   --- R stacktrace ---
  where 1: rdiffnet_check_seed_graph(seed.graph, rgraph.args, t, n)
  where 2 at testthat/test-rdiffnet.R#19: rdiffnet(seed.graph = as.array(x_dgCMatrix)[, , 1], t = 10, rewire.args = list(p = c(0, 
      rep(0.1, 9))))
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: 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 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: 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 13: test_code(desc, code, env = parent.frame())
  where 14 at testthat/test-rdiffnet.R#6: test_that("Input", {
      set.seed(12312)
      x <- rgraph_ba(t = 500 - 1L)
      set.seed(131)
      x_dgCMatrix <- rdiffnet(seed.graph = x, t = 10, rewire.args = list(p = c(0, 
          rep(0.1, 9))))
      set.seed(131)
      x_matrix <- rdiffnet(seed.graph = as.array(x_dgCMatrix)[, 
          , 1], t = 10, rewire.args = list(p = c(0, rep(0.1, 9))))
      set.seed(12312)
      x <- function() {
          out <- rgraph_ba(t = 500 - 1L)
          set.seed(131)
          out
      }
      x_fun <- rdiffnet(seed.graph = x, t = 10, rewire.args = list(p = c(0, 
          rep(0.1, 9))))
      x_dgCMatrix$graph <- as.array(x_dgCMatrix)
      x_matrix$graph <- as.array(x_matrix)
      x_fun$graph <- as.array(x_fun)
      expect_equal(x_dgCMatrix, x_matrix)
      expect_equal(x_dgCMatrix, x_fun)
      set.seed(12312)
      x <- rgraph_ba(t = 500 - 1L)
      x <- list(x, rewire_graph(x, 0.1))
      set.seed(131)
      x_dgCMatrix <- rdiffnet(seed.graph = x, rewire.args = list(p = 0))
      set.seed(131)
      x_matrix <- rdiffnet(seed.graph = as.array(x_dgCMatrix), 
          rewire.args = list(p = 0))
      set.seed(131)
      x_diffnet <- rdiffnet(seed.graph = x_dgCMatrix, rewire.args = list(p = 0))
      x_dgCMatrix$graph <- as.array(x_dgCMatrix)
      x_matrix$graph <- as.array(x_matrix)
      x_diffnet$graph <- as.array(x_diffnet)
      expect_equal(x_dgCMatrix, x_matrix)
      expect_equal(x_dgCMatrix, x_diffnet)
  })
  where 15: eval(code, test_env)
  where 16: eval(code, test_env)
  where 17: 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 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 23: tryCatchList(expr, classes, parentenv, handlers)
  where 24: 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 25: test_code(NULL, exprs, env)
  where 26: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 27: force(code)
  where 28: doWithOneRestart(return(expr), restart)
  where 29: withOneRestart(expr, restarts[[1L]])
  where 30: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 31: 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 32: FUN(X[[i]], ...)
  where 33: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: 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 39: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 40: 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 41: 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 42: test_check("netdiffuseR", reporter = "summary")
  
   --- value of length: 2 type: logical ---
  [1] TRUE TRUE
   --- function from context --- 
  function (seed.graph, rgraph.args, t, n) 
  {
      test <- class(seed.graph)
      if ("function" %in% test) {
          test <- seed.graph()
          if (inherits(test, "dgCMatrix")) {
              sgraph <- test
          }
          else if (inherits(test, "matrix")) {
              sgraph <- methods::as(test, "dgCMatrix")
          }
          else if (inherits(test, "array")) {
              sgraph <- apply(test, 3, function(x) methods::as(x, 
                  "dgCMatrix"))
          }
          else if (inherits(test, "diffnet")) {
              sgraph <- test$graph
          }
          else if (inherits(test, "list")) {
              sgraph <- test
          }
      }
      else if ("character" %in% test) {
          if (seed.graph == "scale-free") {
              if (!length(rgraph.args$m0)) 
                  rgraph.args$t <- n - 1L
              sgraph <- do.call(rgraph_ba, rgraph.args)
          }
          else if (seed.graph == "bernoulli") {
              rgraph.args$n <- n
              sgraph <- do.call(rgraph_er, rgraph.args)
          }
          else if (seed.graph == "small-world") {
              rgraph.args$n <- n
              if (!length(rgraph.args$k)) 
                  rgraph.args$k <- 2L
              if (!length(rgraph.args$p)) 
                  rgraph.args$p <- 0.1
              sgraph <- do.call(rgraph_ws, rgraph.args)
          }
          else stop("Invalid -seed.graph-. It should be either ", 
              "'scale-free', 'bernoulli' or 'small-world'.")
          graph <- rep(list(sgraph), t)
      }
      else if (test %in% c("matrix", "dgCMatrix", "array")) {
          if ("array" %in% test) 
              sgraph <- apply(seed.graph, 3, function(x) methods::as(x, 
                  "dgCMatrix"))
          else sgraph <- methods::as(seed.graph, "dgCMatrix")
      }
      else if ("list" %in% test) {
          sgraph <- seed.graph
      }
      else if ("diffnet" %in% test) {
          sgraph <- seed.graph$graph
      }
      else stop("Invalid argument for -seed.graph-. No support for objects of class -", 
          test, "-.")
      sgraph
  }
  <bytecode: 0x55a196d53818>
  <environment: namespace:netdiffuseR>
   --- function search by body ---
  Function rdiffnet_check_seed_graph in namespace netdiffuseR has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1