I seem to have hit an issue with devtools::check() that appears to be specific to R 3.6.0 RC. I'm seeing this error pop up when checking my goalie assertive check package.
Both rcmdcheck::rcmdcheck() and devtools::test() work when testing this package. However, when I run devtools::check(), I'm seeing this error:
β checking tests ...
E Running βtestthat.Rβ
Running the tests in βtests/testthat.Rβ failed.
Last 13 lines of output:
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
function (n)
{
if (n < 0L || n != round(n)) {
stop("n should be a non-negative integer vector.")
}
}
<bytecode: 0x7fb717950de0>
<environment: namespace:goalie>
--- function search by body ---
Function .checkN in namespace goalie has this body.
----------- END OF FAILURE REPORT --------------
Fatal error: length > 1 in coercion to logical
See
β/private/var/folders/j1/hw6j14mj3wq381x7mynwfbp00000gn/T/RtmppCCIQE/goalie.Rcheck/00check.logβ
for details.
ββ R CMD check results ββββββββββββββββββββββββββββββββββββββ goalie 0.2.14 ββββ
Duration: 45s
β― checking tests ...
See below...
ββ Test failures βββββββββββββββββββββββββββββββββββββββββββββββββ testthat ββββ
> library(testthat)
> library(patrick)
> library(goalie)
> test_check("goalie")
----------- FAILURE REPORT --------------
--- failure: length > 1 in coercion to logical ---
--- srcref ---
:
--- package (from environment) ---
goalie
--- call from context ---
.checkN(n)
--- call from argument ---
n < 0L || n != round(n)
--- R stacktrace ---
where 1: .checkN(n)
where 2: isOfDimension(mtcars, n = c(32L, 11L))
where 3: eval_bare(get_expr(quo), get_env(quo))
where 4: quasi_label(enquo(object), label)
where 5 at testthat/test-check-scalar-hasElements.R#64: expect_true(isOfDimension(mtcars, n = c(32L, 11L)))
where 6: eval(code, test_env)
where 7: eval(code, test_env)
where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 12: doTryCatch(return(expr), name, parentenv, handler)
where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 14: tryCatchList(expr, classes, parentenv, handlers)
where 15: 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 16: test_code(desc, code, env = parent.frame())
where 17 at testthat/test-check-scalar-hasElements.R#63: test_that("TRUE", {
expect_true(isOfDimension(mtcars, n = c(32L, 11L)))
expect_true(isOfDimension("xxx", n = NULL))
})
where 18: eval(code, test_env)
where 19: eval(code, test_env)
where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 24: doTryCatch(return(expr), name, parentenv, handler)
where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 26: tryCatchList(expr, classes, parentenv, handlers)
where 27: 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 28: test_code(NULL, exprs, env)
where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 30: force(code)
where 31: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
end_context()
})
where 32: FUN(X[[i]], ...)
where 33: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 34: force(code)
where 35: 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 36: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 37: 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 38: 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 39: test_check("goalie")
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
function (n)
{
if (n < 0L || n != round(n)) {
stop("n should be a non-negative integer vector.")
}
}
<bytecode: 0x7fb717950de0>
<environment: namespace:goalie>
--- function search by body ---
Function .checkN in namespace goalie has this body.
----------- END OF FAILURE REPORT --------------
Fatal error: length > 1 in coercion to logical
The assert check function in the log (isOfDimension()) does return a boolean flag, so I'm not entirely sure why this step is failing. And like I mentioned, R CMD check does pass, so this seems to be specific to devtools.
isOfDimension(mtcars, n = c(32L, 11L))
# [1] TRUE
R 3.6 turns on a check when you pass a boolean value of length > 1, which is what is happening here. Your condition is returning c(FALSE, FALSE) and the if is ignoring the second one.
If you need more help fixing or debugging this please open an issue at the RStudio community site https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer)
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
Most helpful comment
R 3.6 turns on a check when you pass a boolean value of length > 1, which is what is happening here. Your condition is returning
c(FALSE, FALSE)and the if is ignoring the second one.If you need more help fixing or debugging this please open an issue at the RStudio community site https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer)