- using R Under development (unstable) (2019-12-11 r77556)
- using platform: x86_64-pc-linux-gnu (64-bit)
- using session charset: ISO8859-15
- checking for file 'wsyn/DESCRIPTION' ... OK
- checking extension type ... Package
- this is package 'wsyn' version '1.0.1'
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking serialization versions ... OK
- checking whether package 'wsyn' can be installed ... OK
- checking package directory ... OK
- checking for future file timestamps ... OK
- checking 'build' directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking R files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... OK
- checking whether the package can be loaded with stated dependencies ... OK
- checking whether the package can be unloaded cleanly ... OK
- checking whether the namespace can be loaded with stated dependencies ... OK
- checking whether the namespace can be unloaded cleanly ... OK
- checking loading without being on the library search path ... OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [19s/22s] OK
- checking Rd files ... OK
- checking Rd metadata ... OK
- checking Rd line widths ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking sizes of PDF files under 'inst/doc' ... OK
- checking installed files from 'inst/doc' ... OK
- checking files in 'vignettes' ... OK
- checking examples ... [19s/21s] OK
- checking for unstated dependencies in 'tests' ... OK
- checking tests ... [74s/79s] ERROR
Running 'testthat.R' [74s/79s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(wsyn)
Attaching package: 'wsyn'
The following object is masked from 'package:stats':
power
>
> test_check("wsyn")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
wsyn
--- call from context ---
clust(dat, times, coords, "coh")
--- call from argument ---
if (class(coords) != "data.frame") {
stop("Error in clust: coords must be a data frame")
}
--- R stacktrace ---
where 1: clust(dat, times, coords, "coh")
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers({
code
NULL
}, error = function(cnd) {
if (can_entrace(cnd)) {
cnd <- cnd_entrace(cnd)
}
return_from(env, cnd)
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
where 6 at testthat/tests_clust.R#13: expect_error(clust(dat, times, coords, "coh"), "Error in clust: coords must be a data frame")
where 7: eval(code, test_env)
where 8: eval(code, test_env)
where 9: 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 10: doTryCatch(return(expr), name, parentenv, handler)
where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 13: doTryCatch(return(expr), name, parentenv, handler)
where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 15: tryCatchList(expr, classes, parentenv, handlers)
where 16: 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 17: test_code(desc, code, env = parent.frame())
where 18 at testthat/tests_clust.R#3: test_that("test error checking", {
dat <- matrix(rnorm(300), 10, 30)
times <- 1:30
dat <- cleandat(dat, times, 2)$cdat
coords <- data.frame(X = 1:10, Y = 11:20)
expect_error(clust(dat, times, coords, "coh", weighted = FALSE),
"Error in clust: unweighted networks available only if method involves a significance test")
expect_error(clust(dat, times, coords, "test"), "Error in clust: bad value of method")
coords <- matrix(1:20, 10, 2)
expect_error(clust(dat, times, coords, "coh"), "Error in clust: coords must be a data frame")
coords <- data.frame(X = 1:9, Y = 11:19)
expect_error(clust(dat, times, coords, "coh"), "Error in clust: coords must have one row for each row of dat")
coords <- data.frame(A = 1:10, B = 11:20)
expect_error(clust(dat, times, coords, "coh"), "Error in clust: coords must have columns X and Y, or lon and lat, or longitude and latitude")
})
where 19: eval(code, test_env)
where 20: eval(code, test_env)
where 21: 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 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 25: doTryCatch(return(expr), name, parentenv, handler)
where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 27: tryCatchList(expr, classes, parentenv, handlers)
where 28: 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 29: test_code(NULL, exprs, env)
where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 31: force(code)
where 32: doWithOneRestart(return(expr), restart)
where 33: withOneRestart(expr, restarts[[1L]])
where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 35: 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 36: FUN(X[[i]], ...)
where 37: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 38: force(code)
where 39: doWithOneRestart(return(expr), restart)
where 40: withOneRestart(expr, restarts[[1L]])
where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 42: 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 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 44: 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 45: 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 46: test_check("wsyn")
--- value of length: 2 type: logical ---
[1] TRUE TRUE
--- function from context ---
function (dat, times, coords, method, tsrange = c(0, Inf), nsurrogs = 1000,
scale.min = 2, scale.max.input = NULL, sigma = 1.05, f0 = 1,
weighted = TRUE, sigthresh = 0.95)
{
errcheck_stdat(times, dat, "clust")
if (class(coords) != "data.frame") {
stop("Error in clust: coords must be a data frame")
}
if (dim(coords)[1] != dim(dat)[1]) {
stop("Error in clust: coords must have one row for each row of dat")
}
if (!(all(c("X", "Y") %in% names(coords))) && !(all(c("lat",
"lon") %in% names(coords))) && !(all(c("latitude", "longitude") %in%
names(coords)))) {
stop("Error in clust: coords must have columns X and Y, or lon and lat, or longitude and latitude")
}
if (!(method %in% c("pearson", "pearson.sig.std", "pearson.sig.fft",
"pearson.sig.aaft", "spearman", "spearman.sig.std", "spearman.sig.fft",
"spearman.sig.aaft", "kendall", "kendall.sig.std", "kendall.sig.fft",
"kendall.sig.aaft", "ReXWT", "ReXWT.sig.fft", "ReXWT.sig.aaft",
"ReXWT.sig.fast", "coh", "coh.sig.fft", "coh.sig.aaft",
"coh.sig.fast", "phasecoh", "phasecoh.sig.fft", "phasecoh.sig.aaft"))) {
stop("Error in clust: bad value of method")
}
if ((!weighted) && (!grepl("sig", method))) {
stop("Error in clust: unweighted networks available only if method involves a significance test")
}
errcheck_wavparam(scale.min, scale.max.input, sigma, f0,
times, "clust")
if (sigthresh <= 0 || sigthresh >= 1) {
stop("Error in clust: inappropriate value for sigthresh")
}
methodspecs <- list(method = method, tsrange = tsrange, nsurrogs = nsurrogs,
scale.min = scale.min, scale.max.input = scale.max.input,
sigma = sigma, f0 = f0, weighted = weighted, sigthresh = sigthresh)
adj <- synmat(dat, times, method, tsrange, nsurrogs, scale.min,
scale.max.input, sigma, f0, weighted, sigthresh)
adjd <- adj
diag(adjd) <- 0
clusters <- cluseigen(adjd)
modres <- list()
for (counter in 1:length(clusters)) {
modres[[counter]] <- modularity(adj = adjd, membership = clusters[[counter]],
decomp = TRUE)
}
mns <- list()
for (lcount in 1:length(clusters)) {
mem <- clusters[[lcount]]
mns[[lcount]] <- matrix(NA, max(mem), length(times))
for (ccount in 1:(max(mem))) {
mns[[lcount]][ccount, ] <- apply(FUN = mean, MARGIN = 2,
X = dat[mem == ccount, , drop = F])
}
}
result <- list(dat = dat, times = times, coords = coords,
methodspecs = methodspecs, adj = adj, clusters = clusters,
modres = modres, mns = mns, wmfs = NA, wpmfs = NA)
class(result) <- c("clust", "list")
return(result)
}
<bytecode: 0x57923a8>
<environment: namespace:wsyn>
--- function search by body ---
Function clust in namespace wsyn has this body.
----------- END OF FAILURE REPORT --------------
-- 1. Failure: test error checking (@tests_clust.R#13) ------------------------
`clust(dat, times, coords, "coh")` threw an error with unexpected message.
Expected match: "Error in clust: coords must be a data frame"
Actual message: "the condition has length > 1"
Backtrace:
1. testthat::expect_error(clust(dat, times, coords, "coh"), "Error in clust: coords must be a data frame")
6. wsyn::clust(dat, times, coords, "coh")
== testthat results ===========================================================
[ OK: 933 | SKIPPED: 20 | WARNINGS: 0 | FAILED: 1 ]
1. Failure: test error checking (@tests_clust.R#13)
Error: testthat unit tests failed
Execution halted
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes in 'inst/doc' ... OK
- checking re-building of vignette outputs ... [125s/137s] OK
- checking PDF version of manual ... OK
- checking for non-standard things in the check directory ... OK
- DONE
Status: 1 ERROR