Running ‘testthat.R’ [7s/11s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > ## Test `Hmsc` using the `testthat` package
  > 
  > ## Setup
  > require("testthat")
  Loading required package: testthat
  > require("Hmsc")
  Loading required package: Hmsc
  Loading required package: coda
  > 
  > ## Runs the tests in inst/tests
  > test_check("Hmsc")
  ── 1. Error: WAIC gives correct output (@test-WAIC.R#4)  ───────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. testthat::expect_equal(round(computeWAIC(TD$m), 1), 0.8)
   4. Hmsc::computeWAIC(TD$m)
  
  ── 2. Error: computeInitialParameters gives right number of output parameters (@
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 3. Error: Standard initial beta is correct (@test-initialParameters.R#10)  ──
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 4. Error: Standard initial gamma is correct (@test-initialParameters.R#17)  ─
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 5. Error: Standard initial V is correct (@test-initialParameters.R#24)  ─────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 6. Error: Standard initial Sigma is correct (@test-initialParameters.R#30)  ─
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 7. Error: Standard initial Eta is distributed as N(0,1) (@test-initialParamet
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 8. Error: Standard initial Alpha is correct (@test-initialParameters.R#46)  ─
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 9. Error: Standard initial Rho is correct (@test-initialParameters.R#55)  ───
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 10. Error: Standard initial Lambda is correct (@test-initialParameters.R#61) 
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 11. Error: Standard initial Psi is correct (@test-initialParameters.R#71)  ──
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 12. Error: Standard initial Delta is correct (@test-initialParameters.R#81)  
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 13. Error: Standard initial Z is correct (@test-initialParameters.R#91)  ────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 14. Error: Fixed effects initial beta is correct (@test-initialParameters.R#1
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 15. Error: Fixed effects initial gamma (@test-initialParameters.R#119)  ─────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = "fixed effects")
  
  ── 16. Error: Fixed effects initial V (@test-initialParameters.R#130)  ─────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = "fixed effects")
  
  ── 17. Error: phylogenetic parameters when phylogeny is not provided (@test-init
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 18. Error: spatial parameters when spatial data is not provided (@test-initia
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 19. Error: updateGamma2 is correct (@test-sampling.R#5)  ────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 20. Error: UpdateGammaEta is correct (@test-sampling.R#17)  ─────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 21. Error: updateBetaLambda is correct (@test-sampling.R#37)  ───────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 22. Error: updateGammaV is correct (@test-sampling.R#55)  ───────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 23. Error: updateRho is correct (@test-sampling.R#72)  ──────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 24. Error: updateLambdaPriors is correct (@test-sampling.R#81)  ─────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 25. Error: updateEta is correct (@test-sampling.R#98)  ──────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc:::computeInitialParameters(TD$m, initPar = NULL)
  
  ── 26. Error: updateInvSigma is correct (@test-sampling.R#125)  ────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 27. Error: updateNf is correct (@test-sampling.R#137)  ──────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  [1] "Setting updater$Gamma2=FALSE due to specified phylogeny matrix"
  ── 28. Error: sampleMCMC returns m object of right size (@test-sampling.R#166)  
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::sampleMcmc(TD$m, samples = 1)
   2. Hmsc:::sampleChain(chain)
   3. Hmsc:::computeInitialParameters(hM, initPar)
  
  ── 29. Failure: Hmsc returns error when XData is not a data frame or list of dat
  `Hmsc(Y = matrix(1:10), XData = matrix(1:10))` threw an error with unexpected message.
  Expected match: "Hmsc.setData: XData must either a data.frame or a list of data.frame objects"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:10), XData = matrix(1:10))
  
  ── 30. Failure: Hmsc returns error when X or XData contains NA values (@test-set
  `Hmsc(Y = matrix(1:10), X = list(x1 = matrix(c(1:9, NA))))` threw an error with unexpected message.
  Expected match: "all elements of X list must contain no NA values"
  Actual message: "Hmsc.setData: each element of X list must be a matrix"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:10), X = list(x1 = matrix(c(1:9, NA))))
  
  ── 31. Failure: Hmsc returns error when X or XData contains NA values (@test-set
  `Hmsc(Y = matrix(1:10), X = matrix(c(1:9, NA)))` threw an error with unexpected message.
  Expected match: "X must contain no NA values"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:10), X = matrix(c(1:9, NA)))
  
  ── 32. Failure: Hmsc returns error when the size of X or XData is not correct (@
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: for each element of X list the number of rows must be equal to the number of sampling units"
  Actual message: "Hmsc.setData: each element of X list must be a matrix"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 33. Failure: Hmsc returns error when the size of X or XData is not correct (@
  `Hmsc(Y = matrix(1:20, nrow = 10, ncol = 2), X = matrix(1:9))` threw an error with unexpected message.
  Expected match: "Hmsc.setData: the number of rows in X must be equal to the number of sampling units"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:20, nrow = 10, ncol = 2), X = matrix(1:9))
  
  ── 34. Failure: Hmsc returns error when X contains more than one intercept colum
  `Hmsc(Y = matrix(1:10), X = Xmat)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: only one column of X matrix could be named Intercept or (Intercept)"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:10), X = Xmat)
  
  ── 35. Failure: Hmsc returns error when X contains more than one intercept colum
  `Hmsc(Y = matrix(1:10), XData = Xdat)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: only one column of X matrix could be named Intercept or (Intercept)"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:10), XData = Xdat)
  
  ── 36. Failure: Hmsc returns error when the wrong combination of Tr, TrData and 
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: at maximum one of TrData and Tr arguments can be specified"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 37. Failure: Hmsc returns error when the wrong combination of Tr, TrData and 
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: TrFormula argument must be specified if TrData is provided"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 38. Failure: Hmsc returns error when the wrong combination of Tr, TrData and 
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: Tr must be a matrix"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 39. Failure: Hmsc returns error when trait data does not have the right size 
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: the number of rows in Tr should be equal to number of columns in Y"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 40. Failure: Hmsc returns error when trait data does not have the right size 
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: the number of rows in TrData should be equal to number of columns in Y"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 41. Failure: Hmsc returns error when there are unknowns in trait data (@test-
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: Tr parameter must not contain any NA values"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 42. Failure: Hmsc returns error when there are unknowns in trait data (@test-
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: TrData parameter must not contain any NA values"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 43. Failure: Hmsc returns error when there are unknowns in trait data (@test-
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "object 't2' not found"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 44. Failure: Hmsc returns error when the intercept columns for Tr is not corr
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: only one column of Tr matrix could be named Intercept or (Intercept)"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 45. Failure: Hmsc returns error when the intercept columns for Tr is not corr
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: only one column of Tr matrix could be named Intercept or (Intercept)"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 46. Failure: Hmsc returns error when the intercept columns for Tr is not corr
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: intercept column in Tr matrix must be a column of ones"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 47. Failure: Hmsc returns error when intercept is specified in TrFormula (@te
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: only one column of Tr matrix could be named Intercept or (Intercept)"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 48. Error: Hmsc returns error when intercept is specified in TrFormula (@test
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 49. Failure: Hmsc returns error when both a tree and a correlation matrix are
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: at maximum one of phyloTree and C arguments can be specified"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 50. Failure: Hmsc returns error when  (@test-setHmsc.R#85)  ─────────────────
  `Hmsc(Y = matrix(1:10), X = matrix(1:10), C = TD$C)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: the size of square matrix C must be equal to number of species"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:10), X = matrix(1:10), C = TD$C)
  
  ── 51. Failure: Hmsc returns error when studydesign does not match random levels
  `Hmsc(Y = matrix(1:10), X = matrix(1:10), ranLevels = TD$rL1)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: studyDesign is empty, but ranLevels is not"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(Y = matrix(1:10), X = matrix(1:10), ranLevels = TD$rL1)
  
  ── 52. Failure: Hmsc returns error when studydesign does not match random levels
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: studyDesign must contain named columns corresponding to all levels listed in ranLevelsUsed"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 53. Failure: Hmsc returns error when studydesign does not match random levels
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: studyDesign must contain named columns corresponding to all levels listed in ranLevelsUsed"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 54. Error: Hmsc returns error when studydesign does not match random levels (
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 55. Failure: Hmsc returns error when studydesign does not match Y (@test-setH
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: the number of rows in studyDesign must be equal to number of rows in Y"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 56. Error: Scaling for Y (@test-setHmsc.R#106)  ─────────────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(Y = matrix(1:20, nrow = 10, ncol = 2), X = matrix(1:10))
  
  ── 57. Error: Scaling for X (@test-setHmsc.R#122)  ─────────────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(Y = matrix(1:10), X = matrix(1:10))
  
  ── 58. Error: Scaling for traits (@test-setHmsc.R#137)  ────────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 59. Error: Family set correctly (@test-setHmsc.R#151)  ──────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 60. Error: Variance set correctly (@test-setHmsc.R#155)  ────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 61. Failure: Hmsc returns error when unsuitable data model is given (@test-se
  `Hmsc(...)` threw an error with unexpected message.
  Expected match: "Hmsc.setData: some of the distributions ill defined"
  Actual message: "EXPR must be a length 1 vector"
  Backtrace:
   1. testthat::expect_error(...)
   6. Hmsc::Hmsc(...)
  
  ── 62. Error: Hmsc is set correctly (@test-setHmsc.R#167)  ─────────────────────
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(...)
  
  ── 63. Error: Hmsc returns error when phylo prior is incorrect (@test-setPriors.
  EXPR must be a length 1 vector
  Backtrace:
   1. Hmsc::Hmsc(Y = matrix(1:10), X = matrix(1:10))
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  [ OK: 56 | SKIPPED: 1 | WARNINGS: 0 | FAILED: 63 ]
  1. Error: WAIC gives correct output (@test-WAIC.R#4) 
  2. Error: computeInitialParameters gives right number of output parameters (@test-initialParameters.R#4) 
  3. Error: Standard initial beta is correct (@test-initialParameters.R#10) 
  4. Error: Standard initial gamma is correct (@test-initialParameters.R#17) 
  5. Error: Standard initial V is correct (@test-initialParameters.R#24) 
  6. Error: Standard initial Sigma is correct (@test-initialParameters.R#30) 
  7. Error: Standard initial Eta is distributed as N(0,1) (@test-initialParameters.R#35) 
  8. Error: Standard initial Alpha is correct (@test-initialParameters.R#46) 
  9. Error: Standard initial Rho is correct (@test-initialParameters.R#55) 
  1. ...
  
  Error: testthat unit tests failed
  Execution halted