Running 'testthat.R' [37s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(MRFcov)
  Loading required package: glmnet
  Loading required package: Matrix
  Loading required package: foreach
  Loaded glmnet 2.0-16
  
  Welcome to MRFcov. If you use the package, please cite as: Clark, NJ, Wells, K and Lindberg, O. 2018. Unravelling changing interspecific interactions across environmental gradients using Markov random fields. Ecology doi: 10.1002/ecy.2221 
  > 
  > test_check("MRFcov")
  Leave-one-out cv used for the following low-occurrence (rare) nodes:
   Microfilaria ...
  Fitting MRF models in sequence using 1 core ...
  Leave-one-out cv used for the following low-occurrence (rare) nodes:
   Microfilaria ...
  Fitting MRF models in sequence using 1 core ...
  Fitting bootstrap_MRF models in sequence using 1 core... 
  Leave-one-out cv used for the following low-occurrence (rare) nodes:
   Microfilaria ...
  Fitting MRF models in sequence using 1 core ...
  Leave-one-out cv used for the following low-occurrence (rare) nodes:
   Microfilaria ...
  Fitting MRF models in sequence using 1 core ...
  Leave-one-out cv used for the following low-occurrence (rare) nodes:
   Microfilaria ...
  Fitting MRF models in sequence using 1 core ...
  Leave-one-out cv used for the following low-occurrence (rare) nodes:
   Microfilaria ...
  Fitting MRF models in sequence using 1 core ...
  Leave-one-out cv used for the following low-occurrence (rare) nodes:
   Microfilaria ...
  Fitting MRF models in sequence using 1 core ...
  Fitting MRF models in sequence using 1 core ...
  Fitting MRF models in sequence using 1 core ...
  Poisson variables will be standardised by their square root means. Please
              refer to the "poiss_sc_factors" for coefficient interpretations ...
  Fitting MRF models in sequence using 1 core ...
  Poisson variables will be standardised by their square root means. Please
              refer to the "poiss_sc_factors" for coefficient interpretations ...
  Fitting MRF models in sequence using 1 core ...
  -- 1. Error: (unknown) (@test-cv_MRF_diag.R#64)  -------------------------------
  replacement has 1 row, data has 0
  1: suppressWarnings(cv_MRF_diag(data = poiss.dat, n_nodes = 3, n_folds = 4, n_cores = 1, 
         family = "poisson", compare_null = TRUE, plot = FALSE)) at testthat/test-cv_MRF_diag.R:64
  2: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
  3: cv_MRF_diag(data = poiss.dat, n_nodes = 3, n_folds = 4, n_cores = 1, family = "poisson", 
         compare_null = TRUE, plot = FALSE)
  4: lapply(seq_len(n_folds), function(k) {
         test_data <- data[folds[[k]], ]
         predictions <- predict_MRF(test_data, mrf)
         Deviance <- vector()
         MSE <- vector()
         for (i in seq_len(ncol(predictions))) {
             preds_log <- log(test_data[, i]/predictions[, i])
             preds_log[is.infinite(preds_log)] <- 0
             test_data_wzeros <- test_data
             test_data_wzeros[predictions[, i] == 0, i] <- 0
             Deviance[i] <- mean(2 * sum(test_data_wzeros[, i] * preds_log - (test_data_wzeros[, 
                 i] - predictions[, i])))
             MSE[i] <- mean((test_data[, i] - predictions[, i])^2)
         }
         list(Deviance = mean(Deviance, na.rm = T), MSE = mean(MSE, na.rm = T))
     })
  5: FUN(X[[i]], ...)
  6: `[<-`(`*tmp*`, predictions[, i] == 0, i, value = 0)
  7: `[<-.data.frame`(`*tmp*`, predictions[, i] == 0, i, value = 0)
  8: stop(sprintf(ngettext(N, "replacement has %d row, data has %d", "replacement has %d rows, data has %d"), 
         N, n), domain = NA)
  
  == testthat results  ===========================================================
  OK: 29 SKIPPED: 0 FAILED: 1
  1. Error: (unknown) (@test-cv_MRF_diag.R#64) 
  
  Error: testthat unit tests failed
  Execution halted