Last updated on 2019-11-26 00:51:57 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 0.4.10 | 5.16 | 44.47 | 49.63 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 0.4.10 | 3.61 | 35.01 | 38.62 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 0.4.10 | 73.34 | NOTE | |||
r-devel-linux-x86_64-fedora-gcc | 0.4.10 | 73.58 | NOTE | |||
r-devel-windows-ix86+x86_64 | 0.4.10 | 15.00 | 87.00 | 102.00 | OK | |
r-devel-windows-ix86+x86_64-gcc8 | 0.4.10 | 11.00 | 80.00 | 91.00 | OK | |
r-patched-linux-x86_64 | 0.4.10 | 4.39 | 58.56 | 62.95 | OK | |
r-patched-solaris-x86 | 0.4.10 | 114.90 | NOTE | |||
r-release-linux-x86_64 | 0.4.10 | 4.92 | 61.13 | 66.05 | OK | |
r-release-windows-ix86+x86_64 | 0.4.10 | 16.00 | 81.00 | 97.00 | OK | |
r-release-osx-x86_64 | 0.4.10 | NOTE | ||||
r-oldrel-windows-ix86+x86_64 | 0.4.10 | 6.00 | 94.00 | 100.00 | OK | |
r-oldrel-osx-x86_64 | 0.4.10 | NOTE |
Version: 0.4.10
Check: examples
Result: ERROR
Running examples in 'matsbyname-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: Iminus_byname
> ### Title: Subtract a matrix with named rows and columns from a suitably
> ### named and sized identity matrix ('I')
> ### Aliases: Iminus_byname
>
> ### ** Examples
>
> m <- matrix(c(-21, -12, -21, -10), ncol = 2, dimnames = list(c("b", "a"), c("b", "a"))) %>%
+ setrowtype("Industries") %>% setcoltype("Commodities")
> # Rows and columns are unsorted
> diag(1, nrow = 2) - m
b a
b 22 21
a 12 11
attr(,"rowtype")
[1] "Industries"
attr(,"coltype")
[1] "Commodities"
> # Rows and columns are sorted prior to subtracting from the identity matrix
> Iminus_byname(m)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
matsbyname
--- call from context ---
(function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(-10, -21, -12, -21), margin = c(1, 2))
--- call from argument ---
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
--- R stacktrace ---
where 1: (function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(-10, -21, -12, -21), margin = c(1, 2))
where 2: do.call(FUN, c(list(a), .FUNdots))
where 3: unaryapply_byname(identize_func, a = a, .FUNdots = list(margin = margin),
rowcoltypes = "none")
where 4: identize_byname(A)
where 5: organize_args(a, b, fill = 0, match_type = match_type)
where 6: binaryapply_byname(`-`, minuend, subtrahend)
where 7: difference_byname(identize_byname(A), A)
where 8: (function (a)
{
A <- complete_and_sort(a) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a))
difference_byname(identize_byname(A), A)
})(c(-21, -12, -21, -10))
where 9: do.call(FUN, c(list(a), .FUNdots))
where 10: unaryapply_byname(iminus_func, a = a, rowcoltypes = "all")
where 11: Iminus_byname(m)
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
}
<bytecode: 0xa6a098>
<environment: 0x1606e20>
--- function search by body ---
----------- END OF FAILURE REPORT --------------
Fatal error: the condition has length > 1
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.4.10
Check: tests
Result: ERROR
Running 'testthat.R' [4s/5s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(matsbyname)
>
> test_check("matsbyname")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
matsbyname
--- call from context ---
(function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(11, 21, 12, 22), margin = c(1, 2))
--- call from argument ---
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
--- R stacktrace ---
where 1: (function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(11, 21, 12, 22), margin = c(1, 2))
where 2: do.call(FUN, c(list(a), .FUNdots))
where 3: unaryapply_byname(identize_func, a = a, .FUNdots = list(margin = margin),
rowcoltypes = "none")
where 4: identize_byname(M)
where 5: eval(lhs, parent, parent)
where 6: eval(lhs, parent, parent)
where 7 at testthat/test_Binary.R#262: identize_byname(M) %>% setrownames_byname(c("A", "B")) %>% setcolnames_byname(c("E",
"F"))
where 8: eval(code, test_env)
where 9: eval(code, test_env)
where 10: 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 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 14: doTryCatch(return(expr), name, parentenv, handler)
where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 16: tryCatchList(expr, classes, parentenv, handlers)
where 17: 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 18: test_code(desc, code, env = parent.frame())
where 19 at testthat/test_Binary.R#238: test_that("matrixproduct_byname works as expected", {
V <- matrix(1:6, ncol = 3, dimnames = list(c("i1", "i2"),
c("p1", "p2", "p3"))) %>% setrowtype("Industries") %>%
setcoltype("Products")
Y <- matrix(1:4, ncol = 2, dimnames = list(c("p2", "p1"),
c("s2", "s1"))) %>% setrowtype("Products") %>% setcoltype("Sectors")
Z <- matrix(11:14, ncol = 2, dimnames = list(c("s2", "s1"),
c("c1", "c2"))) %>% setrowtype("Sectors") %>% setcoltype("Columns")
VY <- matrix(c(13, 5, 20, 8), nrow = 2, ncol = 2, byrow = TRUE,
dimnames = list(c("i1", "i2"), c("s1", "s2"))) %>% setrowtype("Industries") %>%
setcoltype("Sectors")
VYZ <- matrixproduct_byname(VY, Z)
expect_error(V %*% Y, "non-conformable arguments")
expect_equal(matrixproduct_byname(V, Y), VY)
expect_equal(matrixproduct_byname(V, Y, Z), VYZ)
M <- matrix(c(11, 12, 21, 22), nrow = 2, ncol = 2, byrow = TRUE) %>%
setrownames_byname(c("C", "D")) %>% setcolnames_byname(c("A",
"B"))
I <- identize_byname(M) %>% setrownames_byname(c("A", "B")) %>%
setcolnames_byname(c("E", "F"))
expect_equal(matrixproduct_byname(M, I), M %>% setcolnames_byname(colnames(I)))
I2 <- I %>% setrownames_byname(c("G", "H"))
expect_equal(matrixproduct_byname(M, I2), matrix(c(0, 0,
0, 0), nrow = 2, ncol = 2, byrow = TRUE) %>% setrownames_byname(c("C",
"D")) %>% setcolnames_byname(c("E", "F")))
expect_equal(M %*% I2, M %>% setrownames_byname(c("C", "D")) %>%
setcolnames_byname(c("E", "F")))
expect_equal(matrixproduct_byname(list(V, V), list(Y, Y)),
list(VY, VY))
DF <- data.frame(V = I(list()), Y = I(list()), Z = I(list()))
DF[[1, "V"]] <- V
DF[[2, "V"]] <- V
DF[[1, "Y"]] <- Y
DF[[2, "Y"]] <- Y
DF[[1, "Z"]] <- Z
DF[[2, "Z"]] <- Z
expect_equal(matrixproduct_byname(DF$V, DF$Y), list(VY, VY))
expect_equal(matrixproduct_byname(DF$V, DF$Y, DF$Z), list(VYZ,
VYZ))
DF_expected <- data.frame(V = I(list()), Y = I(list()), Z = I(list()),
matprods = I(list()), VYZ = I(list()))
DF_expected[[1, "V"]] <- V
DF_expected[[2, "V"]] <- V
DF_expected[[1, "Y"]] <- Y
DF_expected[[2, "Y"]] <- Y
DF_expected[[1, "Z"]] <- Z
DF_expected[[2, "Z"]] <- Z
DF_expected[[1, "matprods"]] <- VY
DF_expected[[2, "matprods"]] <- VY
DF_expected[[1, "VYZ"]] <- VYZ
DF_expected[[2, "VYZ"]] <- VYZ
attr(DF_expected$matprods, which = "class") <- NULL
attr(DF_expected$VYZ, which = "class") <- NULL
expect_equal(DF %>% dplyr::mutate(matprods = matrixproduct_byname(V,
Y), VYZ = matrixproduct_byname(V, Y, Z)), DF_expected)
M <- Y
expect_equal(DF %>% dplyr::mutate(matprods = matrixproduct_byname(V,
M), VYZ = matrixproduct_byname(V, M, Z)), DF_expected)
})
where 20: eval(code, test_env)
where 21: eval(code, test_env)
where 22: 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 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 26: doTryCatch(return(expr), name, parentenv, handler)
where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 28: tryCatchList(expr, classes, parentenv, handlers)
where 29: 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 30: test_code(NULL, exprs, env)
where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 32: force(code)
where 33: doWithOneRestart(return(expr), restart)
where 34: withOneRestart(expr, restarts[[1L]])
where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 36: 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 37: FUN(X[[i]], ...)
where 38: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 39: force(code)
where 40: doWithOneRestart(return(expr), restart)
where 41: withOneRestart(expr, restarts[[1L]])
where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 43: 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 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 45: 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 46: 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 47: test_check("matsbyname")
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
}
<bytecode: 0x423cb20>
<environment: 0x58128f8>
--- function search by body ---
----------- END OF FAILURE REPORT --------------
Fatal error: the condition has length > 1
Flavor: r-devel-linux-x86_64-debian-clang
Version: 0.4.10
Check: examples
Result: ERROR
Running examples in ‘matsbyname-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: Iminus_byname
> ### Title: Subtract a matrix with named rows and columns from a suitably
> ### named and sized identity matrix ('I')
> ### Aliases: Iminus_byname
>
> ### ** Examples
>
> m <- matrix(c(-21, -12, -21, -10), ncol = 2, dimnames = list(c("b", "a"), c("b", "a"))) %>%
+ setrowtype("Industries") %>% setcoltype("Commodities")
> # Rows and columns are unsorted
> diag(1, nrow = 2) - m
b a
b 22 21
a 12 11
attr(,"rowtype")
[1] "Industries"
attr(,"coltype")
[1] "Commodities"
> # Rows and columns are sorted prior to subtracting from the identity matrix
> Iminus_byname(m)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
matsbyname
--- call from context ---
(function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(-10, -21, -12, -21), margin = c(1, 2))
--- call from argument ---
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
--- R stacktrace ---
where 1: (function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(-10, -21, -12, -21), margin = c(1, 2))
where 2: do.call(FUN, c(list(a), .FUNdots))
where 3: unaryapply_byname(identize_func, a = a, .FUNdots = list(margin = margin),
rowcoltypes = "none")
where 4: identize_byname(A)
where 5: organize_args(a, b, fill = 0, match_type = match_type)
where 6: binaryapply_byname(`-`, minuend, subtrahend)
where 7: difference_byname(identize_byname(A), A)
where 8: (function (a)
{
A <- complete_and_sort(a) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a))
difference_byname(identize_byname(A), A)
})(c(-21, -12, -21, -10))
where 9: do.call(FUN, c(list(a), .FUNdots))
where 10: unaryapply_byname(iminus_func, a = a, rowcoltypes = "all")
where 11: Iminus_byname(m)
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
}
<bytecode: 0x55601dfc4080>
<environment: 0x55601eac35e8>
--- function search by body ---
----------- END OF FAILURE REPORT --------------
Fatal error: the condition has length > 1
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.4.10
Check: tests
Result: ERROR
Running ‘testthat.R’ [3s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(matsbyname)
>
> test_check("matsbyname")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
matsbyname
--- call from context ---
(function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(11, 21, 12, 22), margin = c(1, 2))
--- call from argument ---
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
--- R stacktrace ---
where 1: (function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
})(c(11, 21, 12, 22), margin = c(1, 2))
where 2: do.call(FUN, c(list(a), .FUNdots))
where 3: unaryapply_byname(identize_func, a = a, .FUNdots = list(margin = margin),
rowcoltypes = "none")
where 4: identize_byname(M)
where 5: eval(lhs, parent, parent)
where 6: eval(lhs, parent, parent)
where 7 at testthat/test_Binary.R#262: identize_byname(M) %>% setrownames_byname(c("A", "B")) %>% setcolnames_byname(c("E",
"F"))
where 8: eval(code, test_env)
where 9: eval(code, test_env)
where 10: 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 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 14: doTryCatch(return(expr), name, parentenv, handler)
where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 16: tryCatchList(expr, classes, parentenv, handlers)
where 17: 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 18: test_code(desc, code, env = parent.frame())
where 19 at testthat/test_Binary.R#238: test_that("matrixproduct_byname works as expected", {
V <- matrix(1:6, ncol = 3, dimnames = list(c("i1", "i2"),
c("p1", "p2", "p3"))) %>% setrowtype("Industries") %>%
setcoltype("Products")
Y <- matrix(1:4, ncol = 2, dimnames = list(c("p2", "p1"),
c("s2", "s1"))) %>% setrowtype("Products") %>% setcoltype("Sectors")
Z <- matrix(11:14, ncol = 2, dimnames = list(c("s2", "s1"),
c("c1", "c2"))) %>% setrowtype("Sectors") %>% setcoltype("Columns")
VY <- matrix(c(13, 5, 20, 8), nrow = 2, ncol = 2, byrow = TRUE,
dimnames = list(c("i1", "i2"), c("s1", "s2"))) %>% setrowtype("Industries") %>%
setcoltype("Sectors")
VYZ <- matrixproduct_byname(VY, Z)
expect_error(V %*% Y, "non-conformable arguments")
expect_equal(matrixproduct_byname(V, Y), VY)
expect_equal(matrixproduct_byname(V, Y, Z), VYZ)
M <- matrix(c(11, 12, 21, 22), nrow = 2, ncol = 2, byrow = TRUE) %>%
setrownames_byname(c("C", "D")) %>% setcolnames_byname(c("A",
"B"))
I <- identize_byname(M) %>% setrownames_byname(c("A", "B")) %>%
setcolnames_byname(c("E", "F"))
expect_equal(matrixproduct_byname(M, I), M %>% setcolnames_byname(colnames(I)))
I2 <- I %>% setrownames_byname(c("G", "H"))
expect_equal(matrixproduct_byname(M, I2), matrix(c(0, 0,
0, 0), nrow = 2, ncol = 2, byrow = TRUE) %>% setrownames_byname(c("C",
"D")) %>% setcolnames_byname(c("E", "F")))
expect_equal(M %*% I2, M %>% setrownames_byname(c("C", "D")) %>%
setcolnames_byname(c("E", "F")))
expect_equal(matrixproduct_byname(list(V, V), list(Y, Y)),
list(VY, VY))
DF <- data.frame(V = I(list()), Y = I(list()), Z = I(list()))
DF[[1, "V"]] <- V
DF[[2, "V"]] <- V
DF[[1, "Y"]] <- Y
DF[[2, "Y"]] <- Y
DF[[1, "Z"]] <- Z
DF[[2, "Z"]] <- Z
expect_equal(matrixproduct_byname(DF$V, DF$Y), list(VY, VY))
expect_equal(matrixproduct_byname(DF$V, DF$Y, DF$Z), list(VYZ,
VYZ))
DF_expected <- data.frame(V = I(list()), Y = I(list()), Z = I(list()),
matprods = I(list()), VYZ = I(list()))
DF_expected[[1, "V"]] <- V
DF_expected[[2, "V"]] <- V
DF_expected[[1, "Y"]] <- Y
DF_expected[[2, "Y"]] <- Y
DF_expected[[1, "Z"]] <- Z
DF_expected[[2, "Z"]] <- Z
DF_expected[[1, "matprods"]] <- VY
DF_expected[[2, "matprods"]] <- VY
DF_expected[[1, "VYZ"]] <- VYZ
DF_expected[[2, "VYZ"]] <- VYZ
attr(DF_expected$matprods, which = "class") <- NULL
attr(DF_expected$VYZ, which = "class") <- NULL
expect_equal(DF %>% dplyr::mutate(matprods = matrixproduct_byname(V,
Y), VYZ = matrixproduct_byname(V, Y, Z)), DF_expected)
M <- Y
expect_equal(DF %>% dplyr::mutate(matprods = matrixproduct_byname(V,
M), VYZ = matrixproduct_byname(V, M, Z)), DF_expected)
})
where 20: eval(code, test_env)
where 21: eval(code, test_env)
where 22: 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 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 26: doTryCatch(return(expr), name, parentenv, handler)
where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 28: tryCatchList(expr, classes, parentenv, handlers)
where 29: 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 30: test_code(NULL, exprs, env)
where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 32: force(code)
where 33: doWithOneRestart(return(expr), restart)
where 34: withOneRestart(expr, restarts[[1L]])
where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 36: 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 37: FUN(X[[i]], ...)
where 38: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 39: force(code)
where 40: doWithOneRestart(return(expr), restart)
where 41: withOneRestart(expr, restarts[[1L]])
where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 43: 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 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 45: 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 46: 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 47: test_check("matsbyname")
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
function (a, margin)
{
if (class(a) == "numeric" & length(a) == 1) {
return(1)
}
if (!length(margin) %in% c(1, 2)) {
stop("margin should have length 1 or 2 in fractionize_byname")
}
if (length(margin) == 2 && all(margin %in% c(1, 2))) {
stopifnot(nrow(a) == ncol(a))
return(diag(nrow(a)) %>% setrownames_byname(rownames(a)) %>%
setcolnames_byname(colnames(a)) %>% setrowtype(rowtype(a)) %>%
setcoltype(coltype(a)))
}
if (length(margin) != 1 || !(margin %in% c(1, 2))) {
stop(paste("Unknown margin", margin, "in identize_byname. margin should be 1, 2, or c(1,2)."))
}
if (margin == 1) {
return(matrix(rep_len(1, nrow(a)), nrow = nrow(a), ncol = 1) %>%
setrownames_byname(rownames(a)) %>% setcolnames_byname(coltype(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
if (margin == 2) {
return(matrix(rep_len(1, ncol(a)), nrow = 1, ncol = ncol(a)) %>%
setrownames_byname(rowtype(a)) %>% setcolnames_byname(colnames(a)) %>%
setrowtype(rowtype(a)) %>% setcoltype(coltype(a)))
}
}
<bytecode: 0x55f272ca3b18>
<environment: 0x55f2742af860>
--- function search by body ---
----------- END OF FAILURE REPORT --------------
Fatal error: the condition has length > 1
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 0.4.10
Check: dependencies in R code
Result: NOTE
Namespace in Imports field not imported from: ‘dplyr’
All declared Imports should be used.
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-patched-solaris-x86, r-release-osx-x86_64, r-oldrel-osx-x86_64