Running ‘testthat.R’ [5s/7s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(binst)
  > 
  > test_check("binst")
  ── 1. Error: using decision trees partykit (@test_dt.R#4)  ─────────────────────
  could not find function "extree_data"
  1: create_breaks(iris$Sepal.Length, iris$Species, method = "dt") at testthat/test_dt.R:4
  2: create_dtbreaks(x, y, control = control)
  3: do.call(partykit::ctree, c(list(formula = y ~ x, data = df), get_control("dt", control)))
  4: (function (formula, data, subset, weights, na.action = na.pass, offset, cluster, 
         control = ctree_control(...), ytrafo = NULL, converged = NULL, scores = NULL, 
         doFit = TRUE, ...) 
     {
         mf <- match.call(expand.dots = FALSE)
         m <- match(c("formula", "data", "subset", "na.action", "weights", "offset", "cluster", 
             "scores"), names(mf), 0L)
         mf <- mf[c(1L, m)]
         mf$yx <- "none"
         if (is.function(ytrafo)) {
             if (all(c("y", "x") %in% names(formals(ytrafo)))) 
                 mf$yx <- "matrix"
         }
         mf$nmax <- control$nmax
         mf[[1L]] <- quote(extree_data)
         d <- eval(mf, parent.frame())
         subset <- .start_subset(d)
         weights <- model.weights(model.frame(d))
         if (is.function(ytrafo)) {
             if (is.null(control$update)) 
                 control$update <- TRUE
             nf <- names(formals(ytrafo))
             if (all(c("data", "weights", "control") %in% nf)) 
                 ytrafo <- ytrafo(data = d, weights = weights, control = control)
             nf <- names(formals(ytrafo))
             stopifnot(all(c("subset", "weights", "info", "estfun", "object") %in% nf) || 
                 all(c("y", "x", "weights", "offset", "start") %in% nf))
         }
         else {
             if (is.null(control$update)) 
                 control$update <- FALSE
             stopifnot(length(d$variables$x) == 0)
             mfyx <- model.frame(d, yxonly = TRUE)
             mfyx[["(weights)"]] <- mfyx[["(offset)"]] <- NULL
             yvars <- names(mfyx)
             for (yvar in yvars) {
                 sc <- d[[yvar, "scores"]]
                 if (!is.null(sc)) 
                     attr(mfyx[[yvar]], "scores") <- sc
             }
             Y <- .y2infl(mfyx, response = d$variables$y, ytrafo = ytrafo)
             if (!is.null(iy <- d[["yx", type = "index"]])) {
                 Y <- rbind(0, Y)
             }
             ytrafo <- function(subset, weights, info, estfun, object, ...) list(estfun = Y, 
                 unweighted = TRUE)
         }
         if (is.function(converged)) {
             stopifnot(all(c("data", "weights", "control") %in% names(formals(converged))))
             converged <- converged(d, weights, control = control)
         }
         else {
             converged <- TRUE
         }
         update <- function(subset, weights, control, doFit = TRUE) extree_fit(data = d, 
             trafo = ytrafo, converged = converged, partyvars = d$variables$z, subset = subset, 
             weights = weights, ctrl = control, doFit = doFit)
         if (!doFit) 
             return(list(d = d, update = update))
         tree <- update(subset = subset, weights = weights, control = control)
         trafo <- tree$trafo
         tree <- tree$nodes
         mf <- model.frame(d)
         if (is.null(weights)) 
             weights <- rep(1, nrow(mf))
         fitted <- data.frame(`(fitted)` = fitted_node(tree, mf), `(weights)` = weights, 
             check.names = FALSE)
         fitted[[3]] <- mf[, d$variables$y, drop = TRUE]
         names(fitted)[3] <- "(response)"
         ret <- party(tree, data = mf, fitted = fitted, info = list(call = match.call(), 
             control = control))
         ret$update <- update
         ret$trafo <- trafo
         class(ret) <- c("constparty", class(ret))
         ret$terms <- d$terms$all
         return(ret)
     })(formula = y ~ x, data = structure(list(x = c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6, 
     5, 4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 5.8, 5.7, 5.4, 5.1, 5.7, 5.1, 5.4, 5.1, 4.6, 5.1, 
     4.8, 5, 5, 5.2, 5.2, 4.7, 4.8, 5.4, 5.2, 5.5, 4.9, 5, 5.5, 4.9, 4.4, 5.1, 5, 4.5, 
     4.4, 5, 5.1, 4.8, 5.1, 4.6, 5.3, 5, 7, 6.4, 6.9, 5.5, 6.5, 5.7, 6.3, 4.9, 6.6, 5.2, 
     5, 5.9, 6, 6.1, 5.6, 6.7, 5.6, 5.8, 6.2, 5.6, 5.9, 6.1, 6.3, 6.1, 6.4, 6.6, 6.8, 
     6.7, 6, 5.7, 5.5, 5.5, 5.8, 6, 5.4, 6, 6.7, 6.3, 5.6, 5.5, 5.5, 6.1, 5.8, 5, 5.6, 
     5.7, 5.7, 6.2, 5.1, 5.7, 6.3, 5.8, 7.1, 6.3, 6.5, 7.6, 4.9, 7.3, 6.7, 7.2, 6.5, 6.4, 
     6.8, 5.7, 5.8, 6.4, 6.5, 7.7, 7.7, 6, 6.9, 5.6, 7.7, 6.3, 6.7, 7.2, 6.2, 6.1, 6.4, 
     7.2, 7.4, 7.9, 6.4, 6.3, 6.1, 7.7, 6.3, 6.4, 6, 6.9, 6.7, 6.9, 5.8, 6.8, 6.7, 6.7, 
     6.3, 6.5, 6.2, 5.9), y = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("setosa", "versicolor", 
     "virginica"), class = "factor")), .Names = c("x", "y"), row.names = c(NA, -150L), class = "data.frame"))
  5: eval(mf, parent.frame())
  6: eval(mf, parent.frame())
  
  ── 2. Error: using decision trees partykit with controls works (@test_dt.R#10)  
  could not find function "extree_data"
  1: create_breaks(iris$Sepal.Length, iris$Species, method = "dt", control = list(na.action = na.pass)) at testthat/test_dt.R:10
  2: create_dtbreaks(x, y, control = control)
  3: do.call(partykit::ctree, c(list(formula = y ~ x, data = df), get_control("dt", control)))
  4: (function (formula, data, subset, weights, na.action = na.pass, offset, cluster, 
         control = ctree_control(...), ytrafo = NULL, converged = NULL, scores = NULL, 
         doFit = TRUE, ...) 
     {
         mf <- match.call(expand.dots = FALSE)
         m <- match(c("formula", "data", "subset", "na.action", "weights", "offset", "cluster", 
             "scores"), names(mf), 0L)
         mf <- mf[c(1L, m)]
         mf$yx <- "none"
         if (is.function(ytrafo)) {
             if (all(c("y", "x") %in% names(formals(ytrafo)))) 
                 mf$yx <- "matrix"
         }
         mf$nmax <- control$nmax
         mf[[1L]] <- quote(extree_data)
         d <- eval(mf, parent.frame())
         subset <- .start_subset(d)
         weights <- model.weights(model.frame(d))
         if (is.function(ytrafo)) {
             if (is.null(control$update)) 
                 control$update <- TRUE
             nf <- names(formals(ytrafo))
             if (all(c("data", "weights", "control") %in% nf)) 
                 ytrafo <- ytrafo(data = d, weights = weights, control = control)
             nf <- names(formals(ytrafo))
             stopifnot(all(c("subset", "weights", "info", "estfun", "object") %in% nf) || 
                 all(c("y", "x", "weights", "offset", "start") %in% nf))
         }
         else {
             if (is.null(control$update)) 
                 control$update <- FALSE
             stopifnot(length(d$variables$x) == 0)
             mfyx <- model.frame(d, yxonly = TRUE)
             mfyx[["(weights)"]] <- mfyx[["(offset)"]] <- NULL
             yvars <- names(mfyx)
             for (yvar in yvars) {
                 sc <- d[[yvar, "scores"]]
                 if (!is.null(sc)) 
                     attr(mfyx[[yvar]], "scores") <- sc
             }
             Y <- .y2infl(mfyx, response = d$variables$y, ytrafo = ytrafo)
             if (!is.null(iy <- d[["yx", type = "index"]])) {
                 Y <- rbind(0, Y)
             }
             ytrafo <- function(subset, weights, info, estfun, object, ...) list(estfun = Y, 
                 unweighted = TRUE)
         }
         if (is.function(converged)) {
             stopifnot(all(c("data", "weights", "control") %in% names(formals(converged))))
             converged <- converged(d, weights, control = control)
         }
         else {
             converged <- TRUE
         }
         update <- function(subset, weights, control, doFit = TRUE) extree_fit(data = d, 
             trafo = ytrafo, converged = converged, partyvars = d$variables$z, subset = subset, 
             weights = weights, ctrl = control, doFit = doFit)
         if (!doFit) 
             return(list(d = d, update = update))
         tree <- update(subset = subset, weights = weights, control = control)
         trafo <- tree$trafo
         tree <- tree$nodes
         mf <- model.frame(d)
         if (is.null(weights)) 
             weights <- rep(1, nrow(mf))
         fitted <- data.frame(`(fitted)` = fitted_node(tree, mf), `(weights)` = weights, 
             check.names = FALSE)
         fitted[[3]] <- mf[, d$variables$y, drop = TRUE]
         names(fitted)[3] <- "(response)"
         ret <- party(tree, data = mf, fitted = fitted, info = list(call = match.call(), 
             control = control))
         ret$update <- update
         ret$trafo <- trafo
         class(ret) <- c("constparty", class(ret))
         ret$terms <- d$terms$all
         return(ret)
     })(formula = y ~ x, data = structure(list(x = c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6, 
     5, 4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 5.8, 5.7, 5.4, 5.1, 5.7, 5.1, 5.4, 5.1, 4.6, 5.1, 
     4.8, 5, 5, 5.2, 5.2, 4.7, 4.8, 5.4, 5.2, 5.5, 4.9, 5, 5.5, 4.9, 4.4, 5.1, 5, 4.5, 
     4.4, 5, 5.1, 4.8, 5.1, 4.6, 5.3, 5, 7, 6.4, 6.9, 5.5, 6.5, 5.7, 6.3, 4.9, 6.6, 5.2, 
     5, 5.9, 6, 6.1, 5.6, 6.7, 5.6, 5.8, 6.2, 5.6, 5.9, 6.1, 6.3, 6.1, 6.4, 6.6, 6.8, 
     6.7, 6, 5.7, 5.5, 5.5, 5.8, 6, 5.4, 6, 6.7, 6.3, 5.6, 5.5, 5.5, 6.1, 5.8, 5, 5.6, 
     5.7, 5.7, 6.2, 5.1, 5.7, 6.3, 5.8, 7.1, 6.3, 6.5, 7.6, 4.9, 7.3, 6.7, 7.2, 6.5, 6.4, 
     6.8, 5.7, 5.8, 6.4, 6.5, 7.7, 7.7, 6, 6.9, 5.6, 7.7, 6.3, 6.7, 7.2, 6.2, 6.1, 6.4, 
     7.2, 7.4, 7.9, 6.4, 6.3, 6.1, 7.7, 6.3, 6.4, 6, 6.9, 6.7, 6.9, 5.8, 6.8, 6.7, 6.7, 
     6.3, 6.5, 6.2, 5.9), y = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
     1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
     2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("setosa", "versicolor", 
     "virginica"), class = "factor")), .Names = c("x", "y"), row.names = c(NA, -150L), class = "data.frame"), 
         na.action = function (object, ...) 
         object)
  5: eval(mf, parent.frame())
  6: eval(mf, parent.frame())
  
  ── 3. Error: NAs removed in create_breaks correctly (@test_nasremoved.R#6)  ────
  could not find function "extree_data"
  1: expect_warning(create_breaks(x = c(iris$Sepal.Length, NA), y = c(iris$Species, NA), 
         method = "dt")) at testthat/test_nasremoved.R:6
  2: quasi_capture(enquo(object), capture_warnings, label = label)
  3: capture(act$val <- eval_bare(get_expr(quo), get_env(quo)))
  4: withCallingHandlers(code, warning = function(condition) {
         out$push(condition)
         invokeRestart("muffleWarning")
     })
  5: eval_bare(get_expr(quo), get_env(quo))
  6: create_breaks(x = c(iris$Sepal.Length, NA), y = c(iris$Species, NA), method = "dt")
  7: create_dtbreaks(x, y, control = control)
  8: do.call(partykit::ctree, c(list(formula = y ~ x, data = df), get_control("dt", control)))
  9: (function (formula, data, subset, weights, na.action = na.pass, offset, cluster, 
         control = ctree_control(...), ytrafo = NULL, converged = NULL, scores = NULL, 
         doFit = TRUE, ...) 
     {
         mf <- match.call(expand.dots = FALSE)
         m <- match(c("formula", "data", "subset", "na.action", "weights", "offset", "cluster", 
             "scores"), names(mf), 0L)
         mf <- mf[c(1L, m)]
         mf$yx <- "none"
         if (is.function(ytrafo)) {
             if (all(c("y", "x") %in% names(formals(ytrafo)))) 
                 mf$yx <- "matrix"
         }
         mf$nmax <- control$nmax
         mf[[1L]] <- quote(extree_data)
         d <- eval(mf, parent.frame())
         subset <- .start_subset(d)
         weights <- model.weights(model.frame(d))
         if (is.function(ytrafo)) {
             if (is.null(control$update)) 
                 control$update <- TRUE
             nf <- names(formals(ytrafo))
             if (all(c("data", "weights", "control") %in% nf)) 
                 ytrafo <- ytrafo(data = d, weights = weights, control = control)
             nf <- names(formals(ytrafo))
             stopifnot(all(c("subset", "weights", "info", "estfun", "object") %in% nf) || 
                 all(c("y", "x", "weights", "offset", "start") %in% nf))
         }
         else {
             if (is.null(control$update)) 
                 control$update <- FALSE
             stopifnot(length(d$variables$x) == 0)
             mfyx <- model.frame(d, yxonly = TRUE)
             mfyx[["(weights)"]] <- mfyx[["(offset)"]] <- NULL
             yvars <- names(mfyx)
             for (yvar in yvars) {
                 sc <- d[[yvar, "scores"]]
                 if (!is.null(sc)) 
                     attr(mfyx[[yvar]], "scores") <- sc
             }
             Y <- .y2infl(mfyx, response = d$variables$y, ytrafo = ytrafo)
             if (!is.null(iy <- d[["yx", type = "index"]])) {
                 Y <- rbind(0, Y)
             }
             ytrafo <- function(subset, weights, info, estfun, object, ...) list(estfun = Y, 
                 unweighted = TRUE)
         }
         if (is.function(converged)) {
             stopifnot(all(c("data", "weights", "control") %in% names(formals(converged))))
             converged <- converged(d, weights, control = control)
         }
         else {
             converged <- TRUE
         }
         update <- function(subset, weights, control, doFit = TRUE) extree_fit(data = d, 
             trafo = ytrafo, converged = converged, partyvars = d$variables$z, subset = subset, 
             weights = weights, ctrl = control, doFit = doFit)
         if (!doFit) 
             return(list(d = d, update = update))
         tree <- update(subset = subset, weights = weights, control = control)
         trafo <- tree$trafo
         tree <- tree$nodes
         mf <- model.frame(d)
         if (is.null(weights)) 
             weights <- rep(1, nrow(mf))
         fitted <- data.frame(`(fitted)` = fitted_node(tree, mf), `(weights)` = weights, 
             check.names = FALSE)
         fitted[[3]] <- mf[, d$variables$y, drop = TRUE]
         names(fitted)[3] <- "(response)"
         ret <- party(tree, data = mf, fitted = fitted, info = list(call = match.call(), 
             control = control))
         ret$update <- update
         ret$trafo <- trafo
         class(ret) <- c("constparty", class(ret))
         ret$terms <- d$terms$all
         return(ret)
     })(formula = y ~ x, data = structure(list(x = c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6, 
     5, 4.4, 4.9, 5.4, 4.8, 4.8, 4.3, 5.8, 5.7, 5.4, 5.1, 5.7, 5.1, 5.4, 5.1, 4.6, 5.1, 
     4.8, 5, 5, 5.2, 5.2, 4.7, 4.8, 5.4, 5.2, 5.5, 4.9, 5, 5.5, 4.9, 4.4, 5.1, 5, 4.5, 
     4.4, 5, 5.1, 4.8, 5.1, 4.6, 5.3, 5, 7, 6.4,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, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
     3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L)), .Names = c("x", "y"), row.names = c(NA, 
     -150L), class = "data.frame"))
  10: eval(mf, parent.frame())
  11: eval(mf, parent.frame())
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 22 SKIPPED: 0 FAILED: 3
  1. Error: using decision trees partykit (@test_dt.R#4) 
  2. Error: using decision trees partykit with controls works (@test_dt.R#10) 
  3. Error: NAs removed in create_breaks correctly (@test_nasremoved.R#6) 
  
  Error: testthat unit tests failed
  Execution halted