Running ‘misctests.R’ [7s/16s]
  Running ‘phylo4dtests.R’ [5s/17s]
  Running ‘phylosubtest.R’
  Running ‘phylotorture.R’ [6s/18s]
  Running ‘plottest.R’ [5s/13s]
  Running ‘roundtrip.R’ [5s/12s]
  Running ‘test-all.R’ [27s/71s]
  Running ‘testprune.R’ [5s/14s]
Running the tests in ‘tests/phylotorture.R’ failed.
Complete output:
  > ## torture-testing phylo4 objects.
  > library(phylobase)
  > library(ape)
  
  Attaching package: 'ape'
  
  The following object is masked from 'package:phylobase':
  
      edges
  
  > 
  > set.seed(10101)
  > n <- 200
  > p1 <- vector("list", n)
  > ## don't want to slow down R CMD check by doing this every time:
  > ## n <- 10000
  > for (i in 1:n) {
  +     if (i <= n/2) {
  +         e <- matrix(sample(1:10, replace=TRUE, size=10), ncol=2)
  +     }
  +     else {
  +         e <- cbind(sample(rep(11:19, 2)), sample(1:19))
  +         e <- rbind(c(0, sample(11:19, 1)), e)
  +     }
  +     p1[[i]] <- try(phylo4(e), silent=TRUE)
  + }
  There were 50 or more warnings (use warnings() to see the first 50)
  > OKvals <- sapply(p1, class) != "try-error"
  > ## table(sapply(p1[!OKvals], as.character)) # I think this is causing issues with
  > ##  R check because of different width of terminal/output, trying something simpler:
  > message(unique(sapply(p1[!OKvals], as.character)))
  Error in .local(x, ...) : Tree is reticulated.
  Error in names(res) <- switch(type, tip = 1:ntips, internal = seq(from = ntips +  : 
    'names' attribute [2] must be the same length as the vector [1]
  Error in .local(x, ...) : 
    Tips incorrectly labeled. Nodes incorrectly labeled. 
  Error in .local(x, ...) : Nodes incorrectly labeled. 
  
  > sort(unname(table(sapply(p1[!OKvals], as.character))))
  [1]   2  13  34 151
  > if (sum(OKvals))     message("There are ", sum(OKvals), " valid trees...")
  > 
  > if (any(OKvals)) {
  +     p2 <- p1[OKvals]
  +     length(p2)
  +     has.poly <- sapply(p2, hasPoly)
  +     has.sing <- sapply(p2, hasSingle)
  +     has.retic <- sapply(p2, hasRetic)   
  +     message("number of trees with polytomies: ", sum(has.poly))
  +     message("number of trees with singletons: ", sum(has.sing))
  +     message("number of trees with reticulation: ", sum(has.retic))
  +     if (any(has.sing)) {
  +         p4 <- p2[has.sing]
  +         plot(p4[[1]])  ## gives descriptive error
  +         t2 <- try(plot(collapse.singles(as(p2[[1]],"phylo"))))
  +         ## "incorrect number of dimensions"
  +     }
  +     if (any(!has.sing)) {
  +         ## first tree without singles -- HANGS!
  +         ## don't try the plot in an R session you care about ...
  +         p3 <- p2[!has.sing]
  +         ## plot(p2[[13]])
  +     }
  + }
  > 
  > ## elements 8 and 34 are 
  > ## what SHOULD the rules for trees be?
  > 
  > ## (a) reduce node numbers to 1 ... N ?
  > ## (b) check: irreducible, non-cyclic, ... ?
  > 
  > ## convert to matrix format for checking?
  > 
  > reduce_nodenums <- function(e) {
  +     matrix(as.numeric(factor(e)),ncol=2)
  + }
  > 
  > # make an illegal phylo4 object, does it pass checks?
  > # a disconnected node:
  > 
  > t1 <- read.tree (text="((a,b), (c,(d, e)));")
  > plot(t1)
  > 
  > broke1 <- t1
  > broke1$edge[broke1$edge[,2] ==9, 1] <- 9  # disconnect the node, two subtrees, ((a, b), c)  and (d,e)
  > 
  > try(as(broke1, "phylo4") -> tree, silent=TRUE)   # makes a phylo4  object with no warning
  Warning message:
  In checkTree(object) : Tree contains singleton nodes. 
  > try(phylo4(broke1$edge), silent=TRUE)    # constructor makes a phylo4 object with no warning
  Error in as.data.frame.numeric(x[[i]], optional = TRUE) : 
    row names contain missing values
  Calls: <Anonymous> ... data.frame -> as.data.frame -> as.data.frame.numeric
  In addition: Warning messages:
  1: In checkTree(object) : Tree contains singleton nodes. 
  2: In checkTree(object) : Tree contains singleton nodes. 
  Execution halted
Running the tests in ‘tests/test-all.R’ failed.
Complete output:
  > ## This script is only run during R CMD check, so we can set an environment
  > ## variable that will only run tests during R CMD check (or `devtools::check()`)
  > ## and not during `devtools::test()`.
  > 
  > ## Thus in the tests, we can request the NEXUS files that are stored in the
  > ## `inst/` folder, but during the checks, we test the files that have been
  > ## installed (using the `system.file()` function).
  > 
  > library(testthat)
  > 
  > Sys.setenv("R_CMD_CHECK" = "true")
  > 
  > test_check("phylobase")
  Loading required package: phylobase
  Saving _problems/test.readNCL-96.R
  Saving _problems/test.readNCL-112.R
  Saving _problems/test.readNCL-131.R
  Saving _problems/test.setAs-Methods-182.R
  [ FAIL 4 | WARN 2 | SKIP 0 | PASS 632 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test.readNCL.R:96:5'): file with 2 trees (warning normal) ───────────
  Error in `as.data.frame.numeric(x[[i]], optional = TRUE)`: row names contain missing values
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test.readNCL.R:96:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─methods::as(co1Tree1, "data.frame")
   5.   └─phylobase (local) asMethod(object)
   6.     └─phylobase:::.phylo4ToDataFrame(from, edgeOrder = "pretty")
   7.       └─base::data.frame(...)
   8.         ├─base::as.data.frame(x[[i]], optional = TRUE)
   9.         └─base::as.data.frame.numeric(x[[i]], optional = TRUE)
  ── Error ('test.readNCL.R:112:5'): test option simplify ────────────────────────
  Error in `as.data.frame.numeric(x[[i]], optional = TRUE)`: row names contain missing values
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(as(co1, "data.frame")$labelValues, lVco1) at test.readNCL.R:112:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─methods::as(co1, "data.frame")
   5.   └─phylobase (local) asMethod(object)
   6.     └─phylobase:::.phylo4ToDataFrame(from, edgeOrder = "pretty")
   7.       └─base::data.frame(...)
   8.         ├─base::as.data.frame(x[[i]], optional = TRUE)
   9.         └─base::as.data.frame.numeric(x[[i]], optional = TRUE)
  ── Error ('test.readNCL.R:131:5'): test option check.node.labels ───────────────
  Error in `as.data.frame.numeric(x[[i]], optional = TRUE)`: row names contain missing values
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(as(co1, "data.frame")$labelValues, NULL) at test.readNCL.R:131:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─methods::as(co1, "data.frame")
   5.   └─phylobase (local) asMethod(object)
   6.     └─phylobase:::.phylo4ToDataFrame(from, edgeOrder = "pretty")
   7.       └─base::data.frame(...)
   8.         ├─base::as.data.frame(x[[i]], optional = TRUE)
   9.         └─base::as.data.frame.numeric(x[[i]], optional = TRUE)
  ── Error ('test.setAs-Methods.R:182:5'): phylo4 to data.frame ──────────────────
  Error in `as.data.frame.numeric(x[[i]], optional = TRUE)`: row names contain missing values
  Backtrace:
       ▆
    1. ├─testthat::expect_true(is.data.frame(as(phyu, "data.frame"))) at test.setAs-Methods.R:182:5
    2. │ └─testthat::quasi_label(enquo(object), label)
    3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
    4. ├─base::is.data.frame(as(phyu, "data.frame"))
    5. └─methods::as(phyu, "data.frame")
    6.   └─phylobase (local) asMethod(object)
    7.     └─phylobase:::.phylo4ToDataFrame(from, edgeOrder = "pretty")
    8.       └─base::data.frame(...)
    9.         ├─base::as.data.frame(x[[i]], optional = TRUE)
   10.         └─base::as.data.frame.numeric(x[[i]], optional = TRUE)
  
  [ FAIL 4 | WARN 2 | SKIP 0 | PASS 632 ]
  Error:
  ! Test failures.
  Execution halted