Running ‘testthat.R’ [2s/3s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # --------------------------------------------------- #
  > # Author: Marius D. Pascariu
  > # License: MIT
  > # Last update: Wed Jun 05 14:41:16 2019
  > # --------------------------------------------------- #
  > 
  > library(testthat)
  > # expect_message(library(MortalityLaws))
  > 
  > test_check("MortalityLaws")
  Loading required package: MortalityLaws
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  MortalityLaws
   --- call from context --- 
  eval(substitute(expr), data, enclos = parent.frame())
   --- call from argument --- 
  if (!(K$iclass %in% valid_classes)) {
      stop(paste0("The class of the input should be: ", paste(valid_classes, 
          collapse = ", ")), call. = FALSE)
  }
   --- R stacktrace ---
  where 1: eval(substitute(expr), data, enclos = parent.frame())
  where 2: eval(substitute(expr), data, enclos = parent.frame())
  where 3: with.default(input, {
      K <- find.my.case(Dx, Ex, mx, qx, lx, dx)
      C <- K$case
      valid_classes <- c("numeric", "matrix", "data.frame", NULL)
      if (!(K$iclass %in% valid_classes)) {
          stop(paste0("The class of the input should be: ", paste(valid_classes, 
              collapse = ", ")), call. = FALSE)
      }
      SMS <- "contains missing values. These have been replaced with "
      if (!is.null(sex)) {
          if (!(sex %in% c("male", "female", "total"))) 
              stop("'sex' should be: 'male', 'female', 'total' or 'NULL'.", 
                  call. = FALSE)
      }
      if (C == "C1_DxEx") {
          Dx[is.na(Dx)] <- 0
          Ex[is.na(Ex) | Ex == 0] <- 0.01
          if (any(is.na(Dx))) 
              warning("'Dx'", SMS, 0, call. = FALSE)
          if (any(is.na(Ex))) 
              warning("'Ex'", SMS, 0.01, call. = FALSE)
      }
      if (C == "C2_mx") {
          mx <- uxAbove100(x, mx)
      }
      if (C == "C3_qx") {
          qx <- uxAbove100(x, qx)
      }
      if (C == "C4_lx") {
          lx[is.na(lx) & x >= 100] <- 0
          if (any(is.na(lx))) 
              warning("'lx'", SMS, 0, call. = FALSE)
      }
      if (C == "C5_dx") {
          dx[is.na(dx)] <- 0
          if (any(is.na(dx))) 
              warning("'dx'", SMS, 0, call. = FALSE)
      }
      if (!is.null(ax)) {
          if (!is.numeric(ax)) 
              stop("'ax' must be a numeric scalar (or NULL)", call. = FALSE)
          if (!any(length(ax) %in% c(1, length(x)))) 
              stop("'ax' must be a scalar of lenght 1 or a ", "vector of the same dimension as 'x'", 
                  call. = FALSE)
      }
      out <- list(x = x, Dx = Dx, Ex = Ex, mx = mx, qx = qx, lx = lx, 
          dx = dx, sex = sex, lx0 = lx0, ax = ax, iclass = K$iclass, 
          nLT = K$nLT, LTnames = K$LTnames)
      return(out)
  })
  where 4: with(input, {
      K <- find.my.case(Dx, Ex, mx, qx, lx, dx)
      C <- K$case
      valid_classes <- c("numeric", "matrix", "data.frame", NULL)
      if (!(K$iclass %in% valid_classes)) {
          stop(paste0("The class of the input should be: ", paste(valid_classes, 
              collapse = ", ")), call. = FALSE)
      }
      SMS <- "contains missing values. These have been replaced with "
      if (!is.null(sex)) {
          if (!(sex %in% c("male", "female", "total"))) 
              stop("'sex' should be: 'male', 'female', 'total' or 'NULL'.", 
                  call. = FALSE)
      }
      if (C == "C1_DxEx") {
          Dx[is.na(Dx)] <- 0
          Ex[is.na(Ex) | Ex == 0] <- 0.01
          if (any(is.na(Dx))) 
              warning("'Dx'", SMS, 0, call. = FALSE)
          if (any(is.na(Ex))) 
              warning("'Ex'", SMS, 0.01, call. = FALSE)
      }
      if (C == "C2_mx") {
          mx <- uxAbove100(x, mx)
      }
      if (C == "C3_qx") {
          qx <- uxAbove100(x, qx)
      }
      if (C == "C4_lx") {
          lx[is.na(lx) & x >= 100] <- 0
          if (any(is.na(lx))) 
              warning("'lx'", SMS, 0, call. = FALSE)
      }
      if (C == "C5_dx") {
          dx[is.na(dx)] <- 0
          if (any(is.na(dx))) 
              warning("'dx'", SMS, 0, call. = FALSE)
      }
      if (!is.null(ax)) {
          if (!is.numeric(ax)) 
              stop("'ax' must be a numeric scalar (or NULL)", call. = FALSE)
          if (!any(length(ax) %in% c(1, length(x)))) 
              stop("'ax' must be a scalar of lenght 1 or a ", "vector of the same dimension as 'x'", 
                  call. = FALSE)
      }
      out <- list(x = x, Dx = Dx, Ex = Ex, mx = mx, qx = qx, lx = lx, 
          dx = dx, sex = sex, lx0 = lx0, ax = ax, iclass = K$iclass, 
          nLT = K$nLT, LTnames = K$LTnames)
      return(out)
  })
  where 5: LifeTable.check(input)
  where 6: LifeTable(xx, mx = hx, sex = sex, lx0 = lx0, ax = ax)
  where 7: LawTable(x, par = C3, law = "thiele")
  where 8: eval_bare(expr, quo_get_env(quo))
  where 9: quasi_label(enquo(object), arg = "object")
  where 10 at testthat/test_LawTable.R#32: expect_s3_class(LawTable(x, par = C3, law = "thiele"), "LifeTable")
  where 11: eval(code, test_env)
  where 12: eval(code, test_env)
  where 13: 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 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 16: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 19: tryCatchList(expr, classes, parentenv, handlers)
  where 20: 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 21: test_code(NULL, exprs, env)
  where 22: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 23: force(code)
  where 24: doWithOneRestart(return(expr), restart)
  where 25: withOneRestart(expr, restarts[[1L]])
  where 26: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 27: 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 28: FUN(X[[i]], ...)
  where 29: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 36: 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 37: 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 38: test_check("MortalityLaws")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
   --- function search by body ---
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1