Last updated on 2020-02-19 10:48:50 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 1.0.0 | 6.42 | 63.40 | 69.82 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 1.0.0 | 5.03 | 48.21 | 53.24 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 1.0.0 | 82.45 | ERROR | |||
r-devel-linux-x86_64-fedora-gcc | 1.0.0 | 78.91 | ERROR | |||
r-devel-windows-ix86+x86_64 | 1.0.0 | 15.00 | 77.00 | 92.00 | OK | |
r-devel-windows-ix86+x86_64-gcc8 | 1.0.0 | 23.00 | 118.00 | 141.00 | OK | |
r-patched-linux-x86_64 | 1.0.0 | 5.24 | 54.98 | 60.22 | OK | |
r-patched-solaris-x86 | 1.0.0 | 102.40 | WARN | |||
r-release-linux-x86_64 | 1.0.0 | 5.45 | 54.83 | 60.28 | OK | |
r-release-windows-ix86+x86_64 | 1.0.0 | 12.00 | 69.00 | 81.00 | OK | |
r-release-osx-x86_64 | 1.0.0 | WARN | ||||
r-oldrel-windows-ix86+x86_64 | 1.0.0 | 9.00 | 71.00 | 80.00 | OK | |
r-oldrel-osx-x86_64 | 1.0.0 | WARN |
Version: 1.0.0
Check: examples
Result: ERROR
Running examples in 'DecisionAnalysis-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: DecisionAnalysis-package
> ### Title: DecisionAnalysis: Multi-Objective Decision Analysis
> ### Aliases: DecisionAnalysis DecisionAnalysis-package
>
> ### ** Examples
>
>
> #Create a value hierarchy tree
> branches<- as.data.frame(matrix(ncol=5,nrow=7))
> names(branches)<-c("Level1","Level2","Level3","leaves","weights")
> branches[1,]<-rbind("QB","Elusiveness","Speed","Forty","0.092")
> branches[2,]<-rbind("QB","Elusiveness","Agility","Shuttle","0.138")
> branches[3,]<-rbind("QB","Size","","Height","0.096")
> branches[4,]<-rbind("QB","Size","","Weight","0.224")
> branches[5,]<-rbind("QB","Intelligence","","Wonderlic","0.07")
> branches[6,]<-rbind("QB","Strength","Explosiveness","Vertical","0.152")
> branches[7,]<-rbind("QB","Strength","Power","Broad","0.228")
> value_hierarchy_tree(branches$Level1,branches$Level2,branches$Level3,
+ leaves=branches$leaves,weights=branches$weights)
>
>
> #subset NFLcombine data from DecisionAnalysis package
> qbdata <- NFLcombine[1:7,]
>
> #Create SAVF_matrix
> Height <- SAVF_exp_score(qbdata$heightinchestotal, 68, 75.21, 82)
> Weight <- SAVF_exp_score(qbdata$weight, 185, 224.34, 275)
> Forty <- SAVF_exp_score(qbdata$fortyyd, 4.3, 4.81, 5.4, increasing=FALSE)
> Shuttle <- SAVF_exp_score(qbdata$twentyss, 3.8, 4.3, 4.9, increasing=FALSE)
> Vertical <- SAVF_exp_score(qbdata$vertical, 21, 32.04, 40)
> Broad <- SAVF_exp_score(qbdata$broad, 90, 111.24, 130)
> Wonderlic <- SAVF_exp_score(qbdata$wonderlic, 0, 27.08, 50)
> SAVF_matrix = cbind(Height, Weight, Forty, Shuttle, Vertical, Broad, Wonderlic)
>
> #Create weights vector
> weights = c(0.096, 0.224, 0.092, 0.138, 0.152, 0.228, 0.07)
>
> #Calculate MAVF Score
> MAVF_Scores(SAVF_matrix, weights, qbdata$name)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x6b86bb8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(SAVF_matrix) != "matrix") { :
the condition has length > 1
Calls: MAVF_Scores
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 1.0.0
Check: tests
Result: ERROR
Running 'testthat.R' [6s/7s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(DecisionAnalysis)
>
> test_check("DecisionAnalysis")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights2, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights2, names)
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/test_MAVF_breakout.R#21: expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5d5bf88>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
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/test_MAVF_breakout.R#22: expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5d5bf88>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_breakout.R#23: expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5d5bf88>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_breakout.R#24: expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5d5bf88>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_breakout.R#25: expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5d5bf88>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
-- 1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_bre
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_breakout(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_scores.R#23: expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5d7c878>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_scores.R#24: expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5d7c878>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_scores.R#25: expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5d7c878>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
-- 2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_score
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_Scores(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval_bare(expr, quo_get_env(quo))
where 3: quasi_label(enquo(object), label, arg = "object")
where 4 at testthat/test_MAVF_scores.R#33: expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
where 5: eval(code, test_env)
where 6: eval(code, test_env)
where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 13: tryCatchList(expr, classes, parentenv, handlers)
where 14: 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 15: test_code(desc, code, env = parent.frame())
where 16 at testthat/test_MAVF_scores.R#32: test_that("MAVF_scores has correct dimensions and output type",
{
expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
expect_length(MAVF_Scores(SAVF_matrix, weights, names),
2)
})
where 17: eval(code, test_env)
where 18: eval(code, test_env)
where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 25: tryCatchList(expr, classes, parentenv, handlers)
where 26: 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 27: test_code(NULL, exprs, env)
where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 29: force(code)
where 30: doWithOneRestart(return(expr), restart)
where 31: withOneRestart(expr, restarts[[1L]])
where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 33: 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 34: FUN(X[[i]], ...)
where 35: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 36: force(code)
where 37: doWithOneRestart(return(expr), restart)
where 38: withOneRestart(expr, restarts[[1L]])
where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 42: 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 43: 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 44: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5d7c878>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
-- 3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scor
the condition has length > 1
Backtrace:
1. testthat::expect_is(...)
4. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: as.matrix(MAVF_Scores(SAVF_matrix, weights, names))
where 3: eval_bare(expr, quo_get_env(quo))
where 4: quasi_label(enquo(object), label, arg = "object")
where 5 at testthat/test_MAVF_scores.R#50: expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
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_MAVF_scores.R#49: test_that("MAVF_Scores computes correctly", {
expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
})
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: 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 = 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 35: FUN(X[[i]], ...)
where 36: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 37: force(code)
where 38: doWithOneRestart(return(expr), restart)
where 39: withOneRestart(expr, restarts[[1L]])
where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 43: 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 44: 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 45: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5d7c878>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
-- 4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50) ----------
the condition has length > 1
Backtrace:
1. testthat::expect_equivalent(...)
5. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
-- 5. Failure: SAVF_categorical_score has correct dimensions and output type (@t
SAVF_categorical_score(...) has length 3, not length 1.
-- 6. Failure: SAVF_categorical_score computes correctly (@test_SAVF_categorical
SAVF_categorical_score(...) not equal to 0.1.
Lengths differ: 3 is not 1
-- 7. Failure: SAVF_categorical_score computes correctly (@test_SAVF_categorical
SAVF_categorical_score("9", c("5", "3", "9"), c(0.1, 0.25, 0.65)) not equal to 0.65.
Lengths differ: 3 is not 1
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights2, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights2, names, 4)
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/test_sensitivity_plot.R#21: expect_error(sensitivity_plot(SAVF_matrix, weights2, names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5d36ca0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
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/test_sensitivity_plot.R#22: expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5d36ca0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
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/test_sensitivity_plot.R#23: expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights, names,
4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5d36ca0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
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/test_sensitivity_plot.R#24: expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5d36ca0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_sensitivity_plot.R#25: expect_warning(sensitivity_plot(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5d36ca0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
-- 8. Error: sensitivity_plot provides proper messages and warnings (@test_sensi
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::sensitivity_plot(...)
== testthat results ===========================================================
[ OK: 60 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 8 ]
1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_breakout.R#25)
2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_scores.R#25)
3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scores.R#33)
4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50)
5. Failure: SAVF_categorical_score has correct dimensions and output type (@test_SAVF_categorical_score.R#9)
6. Failure: SAVF_categorical_score computes correctly (@test_SAVF_categorical_score.R#13)
7. Failure: SAVF_categorical_score computes correctly (@test_SAVF_categorical_score.R#14)
8. Error: sensitivity_plot provides proper messages and warnings (@test_sensitivity_plot.R#25)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 1.0.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
...
--- re-building 'MultiObjectiveDecisionAnalysisinR.Rmd' using rmarkdown
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'gridExtra'
The following object is masked from 'package:dplyr':
combine
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval(expr, envir, enclos)
where 3: eval(expr, envir, enclos)
where 4: withVisible(eval(expr, envir, enclos))
where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
where 9: evaluate::evaluate(...)
where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options))
where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options)))
where 12: block_exec(params)
where 13: call_block(x)
where 14: process_group.block(group)
where 15: process_group(group)
where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
where 17: process_file(text, output)
where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
output_dir = getwd(), ...)
where 20: vweave_rmarkdown(...)
where 21: engine$weave(file, quiet = quiet, encoding = enc)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: tryCatch({
engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir)
output <- find_vignette_product(name, by = "weave", engine = engine)
if (!have.makefile && vignette_is_tex(output)) {
texi2pdf(file = output, clean = FALSE, quiet = quiet)
output <- find_vignette_product(name, by = "texi2pdf",
engine = engine)
}
outputs <- c(outputs, output)
}, error = function(e) {
thisOK <<- FALSE
fails <<- c(fails, file)
message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)))
})
where 26: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/DecisionAnalysis.Rcheck/vign_test/DecisionAnalysis",
ser_elibs = "/tmp/RtmpCrd4I5/file15624d0b8a7c.rds")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0xa1be5e8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Quitting from lines 188-203 (MultiObjectiveDecisionAnalysisinR.Rmd)
Error: processing vignette 'MultiObjectiveDecisionAnalysisinR.Rmd' failed with diagnostics:
the condition has length > 1
--- failed re-building 'MultiObjectiveDecisionAnalysisinR.Rmd'
SUMMARY: processing the following file failed:
'MultiObjectiveDecisionAnalysisinR.Rmd'
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 1.0.0
Check: examples
Result: ERROR
Running examples in ‘DecisionAnalysis-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: DecisionAnalysis-package
> ### Title: DecisionAnalysis: Multi-Objective Decision Analysis
> ### Aliases: DecisionAnalysis DecisionAnalysis-package
>
> ### ** Examples
>
>
> #Create a value hierarchy tree
> branches<- as.data.frame(matrix(ncol=5,nrow=7))
> names(branches)<-c("Level1","Level2","Level3","leaves","weights")
> branches[1,]<-rbind("QB","Elusiveness","Speed","Forty","0.092")
> branches[2,]<-rbind("QB","Elusiveness","Agility","Shuttle","0.138")
> branches[3,]<-rbind("QB","Size","","Height","0.096")
> branches[4,]<-rbind("QB","Size","","Weight","0.224")
> branches[5,]<-rbind("QB","Intelligence","","Wonderlic","0.07")
> branches[6,]<-rbind("QB","Strength","Explosiveness","Vertical","0.152")
> branches[7,]<-rbind("QB","Strength","Power","Broad","0.228")
> value_hierarchy_tree(branches$Level1,branches$Level2,branches$Level3,
+ leaves=branches$leaves,weights=branches$weights)
>
>
> #subset NFLcombine data from DecisionAnalysis package
> qbdata <- NFLcombine[1:7,]
>
> #Create SAVF_matrix
> Height <- SAVF_exp_score(qbdata$heightinchestotal, 68, 75.21, 82)
> Weight <- SAVF_exp_score(qbdata$weight, 185, 224.34, 275)
> Forty <- SAVF_exp_score(qbdata$fortyyd, 4.3, 4.81, 5.4, increasing=FALSE)
> Shuttle <- SAVF_exp_score(qbdata$twentyss, 3.8, 4.3, 4.9, increasing=FALSE)
> Vertical <- SAVF_exp_score(qbdata$vertical, 21, 32.04, 40)
> Broad <- SAVF_exp_score(qbdata$broad, 90, 111.24, 130)
> Wonderlic <- SAVF_exp_score(qbdata$wonderlic, 0, 27.08, 50)
> SAVF_matrix = cbind(Height, Weight, Forty, Shuttle, Vertical, Broad, Wonderlic)
>
> #Create weights vector
> weights = c(0.096, 0.224, 0.092, 0.138, 0.152, 0.228, 0.07)
>
> #Calculate MAVF Score
> MAVF_Scores(SAVF_matrix, weights, qbdata$name)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5615e462acf0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(SAVF_matrix) != "matrix") { :
the condition has length > 1
Calls: MAVF_Scores
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.0.0
Check: tests
Result: ERROR
Running ‘testthat.R’ [5s/9s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(DecisionAnalysis)
>
> test_check("DecisionAnalysis")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights2, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights2, names)
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/test_MAVF_breakout.R#21: expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x55cb926a8360>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
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/test_MAVF_breakout.R#22: expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x55cb926a8360>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_breakout.R#23: expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x55cb926a8360>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_breakout.R#24: expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x55cb926a8360>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_breakout.R#25: expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x55cb926a8360>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_bre
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_breakout(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_scores.R#23: expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x55cb926def30>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_scores.R#24: expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x55cb926def30>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_scores.R#25: expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x55cb926def30>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_score
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_Scores(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval_bare(expr, quo_get_env(quo))
where 3: quasi_label(enquo(object), label, arg = "object")
where 4 at testthat/test_MAVF_scores.R#33: expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
where 5: eval(code, test_env)
where 6: eval(code, test_env)
where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 13: tryCatchList(expr, classes, parentenv, handlers)
where 14: 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 15: test_code(desc, code, env = parent.frame())
where 16 at testthat/test_MAVF_scores.R#32: test_that("MAVF_scores has correct dimensions and output type",
{
expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
expect_length(MAVF_Scores(SAVF_matrix, weights, names),
2)
})
where 17: eval(code, test_env)
where 18: eval(code, test_env)
where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 25: tryCatchList(expr, classes, parentenv, handlers)
where 26: 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 27: test_code(NULL, exprs, env)
where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 29: force(code)
where 30: doWithOneRestart(return(expr), restart)
where 31: withOneRestart(expr, restarts[[1L]])
where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 33: 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 34: FUN(X[[i]], ...)
where 35: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 36: force(code)
where 37: doWithOneRestart(return(expr), restart)
where 38: withOneRestart(expr, restarts[[1L]])
where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 42: 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 43: 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 44: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x55cb926def30>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scor
the condition has length > 1
Backtrace:
1. testthat::expect_is(...)
4. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: as.matrix(MAVF_Scores(SAVF_matrix, weights, names))
where 3: eval_bare(expr, quo_get_env(quo))
where 4: quasi_label(enquo(object), label, arg = "object")
where 5 at testthat/test_MAVF_scores.R#50: expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
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_MAVF_scores.R#49: test_that("MAVF_Scores computes correctly", {
expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
})
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: 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 = 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 35: FUN(X[[i]], ...)
where 36: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 37: force(code)
where 38: doWithOneRestart(return(expr), restart)
where 39: withOneRestart(expr, restarts[[1L]])
where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 43: 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 44: 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 45: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x55cb926def30>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50) ──────────
the condition has length > 1
Backtrace:
1. testthat::expect_equivalent(...)
5. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights2, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights2, names, 4)
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/test_sensitivity_plot.R#21: expect_error(sensitivity_plot(SAVF_matrix, weights2, names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x55cb9268e5d8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
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/test_sensitivity_plot.R#22: expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x55cb9268e5d8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
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/test_sensitivity_plot.R#23: expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights, names,
4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x55cb9268e5d8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
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/test_sensitivity_plot.R#24: expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x55cb9268e5d8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_sensitivity_plot.R#25: expect_warning(sensitivity_plot(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x55cb9268e5d8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 5. Error: sensitivity_plot provides proper messages and warnings (@test_sensi
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::sensitivity_plot(...)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 63 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 5 ]
1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_breakout.R#25)
2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_scores.R#25)
3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scores.R#33)
4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50)
5. Error: sensitivity_plot provides proper messages and warnings (@test_sensitivity_plot.R#25)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.0.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
...
--- re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’ using rmarkdown
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'gridExtra'
The following object is masked from 'package:dplyr':
combine
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval(expr, envir, enclos)
where 3: eval(expr, envir, enclos)
where 4: withVisible(eval(expr, envir, enclos))
where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
where 9: evaluate::evaluate(...)
where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options))
where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options)))
where 12: block_exec(params)
where 13: call_block(x)
where 14: process_group.block(group)
where 15: process_group(group)
where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
where 17: process_file(text, output)
where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
output_dir = getwd(), ...)
where 20: vweave_rmarkdown(...)
where 21: engine$weave(file, quiet = quiet, encoding = enc)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: tryCatch({
engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir)
output <- find_vignette_product(name, by = "weave", engine = engine)
if (!have.makefile && vignette_is_tex(output)) {
texi2pdf(file = output, clean = FALSE, quiet = quiet)
output <- find_vignette_product(name, by = "texi2pdf",
engine = engine)
}
outputs <- c(outputs, output)
}, error = function(e) {
thisOK <<- FALSE
fails <<- c(fails, file)
message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)))
})
where 26: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/DecisionAnalysis.Rcheck/vign_test/DecisionAnalysis",
ser_elibs = "/home/hornik/tmp/scratch/RtmpYlYjbp/file7f385bd3b95e.rds")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x563060ed8798>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Quitting from lines 188-203 (MultiObjectiveDecisionAnalysisinR.Rmd)
Error: processing vignette 'MultiObjectiveDecisionAnalysisinR.Rmd' failed with diagnostics:
the condition has length > 1
--- failed re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’
SUMMARY: processing the following file failed:
‘MultiObjectiveDecisionAnalysisinR.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.0.0
Check: dependencies in R code
Result: NOTE
Namespace in Imports field not imported from: ‘DiagrammeR’
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
Version: 1.0.0
Check: examples
Result: ERROR
Running examples in ‘DecisionAnalysis-Ex.R’ failed
The error most likely occurred in:
> ### Name: DecisionAnalysis-package
> ### Title: DecisionAnalysis: Multi-Objective Decision Analysis
> ### Aliases: DecisionAnalysis DecisionAnalysis-package
>
> ### ** Examples
>
>
> #Create a value hierarchy tree
> branches<- as.data.frame(matrix(ncol=5,nrow=7))
> names(branches)<-c("Level1","Level2","Level3","leaves","weights")
> branches[1,]<-rbind("QB","Elusiveness","Speed","Forty","0.092")
> branches[2,]<-rbind("QB","Elusiveness","Agility","Shuttle","0.138")
> branches[3,]<-rbind("QB","Size","","Height","0.096")
> branches[4,]<-rbind("QB","Size","","Weight","0.224")
> branches[5,]<-rbind("QB","Intelligence","","Wonderlic","0.07")
> branches[6,]<-rbind("QB","Strength","Explosiveness","Vertical","0.152")
> branches[7,]<-rbind("QB","Strength","Power","Broad","0.228")
> value_hierarchy_tree(branches$Level1,branches$Level2,branches$Level3,
+ leaves=branches$leaves,weights=branches$weights)
>
>
> #subset NFLcombine data from DecisionAnalysis package
> qbdata <- NFLcombine[1:7,]
>
> #Create SAVF_matrix
> Height <- SAVF_exp_score(qbdata$heightinchestotal, 68, 75.21, 82)
> Weight <- SAVF_exp_score(qbdata$weight, 185, 224.34, 275)
> Forty <- SAVF_exp_score(qbdata$fortyyd, 4.3, 4.81, 5.4, increasing=FALSE)
> Shuttle <- SAVF_exp_score(qbdata$twentyss, 3.8, 4.3, 4.9, increasing=FALSE)
> Vertical <- SAVF_exp_score(qbdata$vertical, 21, 32.04, 40)
> Broad <- SAVF_exp_score(qbdata$broad, 90, 111.24, 130)
> Wonderlic <- SAVF_exp_score(qbdata$wonderlic, 0, 27.08, 50)
> SAVF_matrix = cbind(Height, Weight, Forty, Shuttle, Vertical, Broad, Wonderlic)
>
> #Create weights vector
> weights = c(0.096, 0.224, 0.092, 0.138, 0.152, 0.228, 0.07)
>
> #Calculate MAVF Score
> MAVF_Scores(SAVF_matrix, weights, qbdata$name)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x6be55a0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(SAVF_matrix) != "matrix") { :
the condition has length > 1
Calls: MAVF_Scores
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 1.0.0
Check: tests
Result: ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(DecisionAnalysis)
>
> test_check("DecisionAnalysis")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights2, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights2, names)
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/test_MAVF_breakout.R#21: expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5df3628>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
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/test_MAVF_breakout.R#22: expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5df3628>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_breakout.R#23: expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5df3628>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_breakout.R#24: expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5df3628>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_breakout.R#25: expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x5df3628>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_bre
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_breakout(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_scores.R#23: expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5e24dd8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_scores.R#24: expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5e24dd8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_scores.R#25: expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5e24dd8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_score
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_Scores(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval_bare(expr, quo_get_env(quo))
where 3: quasi_label(enquo(object), label, arg = "object")
where 4 at testthat/test_MAVF_scores.R#33: expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
where 5: eval(code, test_env)
where 6: eval(code, test_env)
where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 13: tryCatchList(expr, classes, parentenv, handlers)
where 14: 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 15: test_code(desc, code, env = parent.frame())
where 16 at testthat/test_MAVF_scores.R#32: test_that("MAVF_scores has correct dimensions and output type",
{
expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
expect_length(MAVF_Scores(SAVF_matrix, weights, names),
2)
})
where 17: eval(code, test_env)
where 18: eval(code, test_env)
where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 25: tryCatchList(expr, classes, parentenv, handlers)
where 26: 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 27: test_code(NULL, exprs, env)
where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 29: force(code)
where 30: doWithOneRestart(return(expr), restart)
where 31: withOneRestart(expr, restarts[[1L]])
where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 33: 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 34: FUN(X[[i]], ...)
where 35: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 36: force(code)
where 37: doWithOneRestart(return(expr), restart)
where 38: withOneRestart(expr, restarts[[1L]])
where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 42: 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 43: 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 44: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5e24dd8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scor
the condition has length > 1
Backtrace:
1. testthat::expect_is(...)
4. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: as.matrix(MAVF_Scores(SAVF_matrix, weights, names))
where 3: eval_bare(expr, quo_get_env(quo))
where 4: quasi_label(enquo(object), label, arg = "object")
where 5 at testthat/test_MAVF_scores.R#50: expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
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_MAVF_scores.R#49: test_that("MAVF_Scores computes correctly", {
expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
})
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: 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 = 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 35: FUN(X[[i]], ...)
where 36: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 37: force(code)
where 38: doWithOneRestart(return(expr), restart)
where 39: withOneRestart(expr, restarts[[1L]])
where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 43: 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 44: 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 45: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x5e24dd8>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50) ──────────
the condition has length > 1
Backtrace:
1. testthat::expect_equivalent(...)
5. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights2, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights2, names, 4)
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/test_sensitivity_plot.R#21: expect_error(sensitivity_plot(SAVF_matrix, weights2, names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5deaf20>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
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/test_sensitivity_plot.R#22: expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5deaf20>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
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/test_sensitivity_plot.R#23: expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights, names,
4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5deaf20>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
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/test_sensitivity_plot.R#24: expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5deaf20>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_sensitivity_plot.R#25: expect_warning(sensitivity_plot(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x5deaf20>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 5. Error: sensitivity_plot provides proper messages and warnings (@test_sensi
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::sensitivity_plot(...)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 63 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 5 ]
1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_breakout.R#25)
2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_scores.R#25)
3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scores.R#33)
4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50)
5. Error: sensitivity_plot provides proper messages and warnings (@test_sensitivity_plot.R#25)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 1.0.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
--- re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’ using rmarkdown
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'gridExtra'
The following object is masked from 'package:dplyr':
combine
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval(expr, envir, enclos)
where 3: eval(expr, envir, enclos)
where 4: withVisible(eval(expr, envir, enclos))
where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
where 9: evaluate::evaluate(...)
where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options))
where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options)))
where 12: block_exec(params)
where 13: call_block(x)
where 14: process_group.block(group)
where 15: process_group(group)
where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
where 17: process_file(text, output)
where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
output_dir = getwd(), ...)
where 20: vweave_rmarkdown(...)
where 21: engine$weave(file, quiet = quiet, encoding = enc)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: tryCatch({
engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir)
output <- find_vignette_product(name, by = "weave", engine = engine)
if (!have.makefile && vignette_is_tex(output)) {
texi2pdf(file = output, clean = FALSE, quiet = quiet)
output <- find_vignette_product(name, by = "texi2pdf",
engine = engine)
}
outputs <- c(outputs, output)
}, error = function(e) {
thisOK <<- FALSE
fails <<- c(fails, file)
message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)))
})
where 26: tools:::buildVignettes(dir = "/data/gannet/ripley/R/packages/tests-clang/DecisionAnalysis.Rcheck/vign_test/DecisionAnalysis",
ser_elibs = "/tmp/Rtmpo5UfUG/file77c630ac6d7.rds")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0xac6a7a0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Quitting from lines 188-203 (MultiObjectiveDecisionAnalysisinR.Rmd)
Error: processing vignette 'MultiObjectiveDecisionAnalysisinR.Rmd' failed with diagnostics:
the condition has length > 1
--- failed re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’
SUMMARY: processing the following file failed:
‘MultiObjectiveDecisionAnalysisinR.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 1.0.0
Check: examples
Result: ERROR
Running examples in ‘DecisionAnalysis-Ex.R’ failed
The error most likely occurred in:
> ### Name: DecisionAnalysis-package
> ### Title: DecisionAnalysis: Multi-Objective Decision Analysis
> ### Aliases: DecisionAnalysis DecisionAnalysis-package
>
> ### ** Examples
>
>
> #Create a value hierarchy tree
> branches<- as.data.frame(matrix(ncol=5,nrow=7))
> names(branches)<-c("Level1","Level2","Level3","leaves","weights")
> branches[1,]<-rbind("QB","Elusiveness","Speed","Forty","0.092")
> branches[2,]<-rbind("QB","Elusiveness","Agility","Shuttle","0.138")
> branches[3,]<-rbind("QB","Size","","Height","0.096")
> branches[4,]<-rbind("QB","Size","","Weight","0.224")
> branches[5,]<-rbind("QB","Intelligence","","Wonderlic","0.07")
> branches[6,]<-rbind("QB","Strength","Explosiveness","Vertical","0.152")
> branches[7,]<-rbind("QB","Strength","Power","Broad","0.228")
> value_hierarchy_tree(branches$Level1,branches$Level2,branches$Level3,
+ leaves=branches$leaves,weights=branches$weights)
>
>
> #subset NFLcombine data from DecisionAnalysis package
> qbdata <- NFLcombine[1:7,]
>
> #Create SAVF_matrix
> Height <- SAVF_exp_score(qbdata$heightinchestotal, 68, 75.21, 82)
> Weight <- SAVF_exp_score(qbdata$weight, 185, 224.34, 275)
> Forty <- SAVF_exp_score(qbdata$fortyyd, 4.3, 4.81, 5.4, increasing=FALSE)
> Shuttle <- SAVF_exp_score(qbdata$twentyss, 3.8, 4.3, 4.9, increasing=FALSE)
> Vertical <- SAVF_exp_score(qbdata$vertical, 21, 32.04, 40)
> Broad <- SAVF_exp_score(qbdata$broad, 90, 111.24, 130)
> Wonderlic <- SAVF_exp_score(qbdata$wonderlic, 0, 27.08, 50)
> SAVF_matrix = cbind(Height, Weight, Forty, Shuttle, Vertical, Broad, Wonderlic)
>
> #Create weights vector
> weights = c(0.096, 0.224, 0.092, 0.138, 0.152, 0.228, 0.07)
>
> #Calculate MAVF Score
> MAVF_Scores(SAVF_matrix, weights, qbdata$name)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, qbdata$name)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x36bba20>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(SAVF_matrix) != "matrix") { :
the condition has length > 1
Calls: MAVF_Scores
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc
Version: 1.0.0
Check: tests
Result: ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(DecisionAnalysis)
>
> test_check("DecisionAnalysis")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights2, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights2, names)
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/test_MAVF_breakout.R#21: expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x6093e78>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights = SAVF_matrix, names)
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/test_MAVF_breakout.R#22: expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x6093e78>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_breakout.R#23: expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x6093e78>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_breakout.R#24: expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x6093e78>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_breakout.R#25: expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_breakout.R#18: test_that("MAVF_breakout provides proper messages and warnings",
{
expect_error(MAVF_breakout(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_breakout(SAVF_matrix, weights2, names))
expect_error(MAVF_breakout(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_breakout(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_breakout(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_breakout(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
Measurement <- dplyr::quo(Measurement)
Value <- dplyr::quo(Value)
SAVF_matrix[is.na(SAVF_matrix)] <- 0
SAVF <- t(SAVF_matrix) * weights
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF, t(SAVF))
`%>%` <- dplyr::`%>%`
value %>% tidyr::gather(Measurement, Value, -c(1:2)) %>%
dplyr::group_by(Measurement) %>% ggplot2::ggplot(ggplot2::aes(x = stats::reorder(names,
MAVF), y = Value, fill = Measurement)) + ggplot2::geom_bar(stat = "identity") +
ggplot2::coord_flip() + ggplot2::ylab("Weighted SAVF Scores") +
ggplot2::xlab("Alternatives") + ggplot2::ggtitle("Breakout of Weighted SAVF")
}
<bytecode: 0x6093e78>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_breakout in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_bre
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_breakout(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix[, 1:6], weights, names)
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/test_MAVF_scores.R#23: expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights, names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x60cac08>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"))
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/test_MAVF_scores.R#24: expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x60cac08>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_MAVF_scores.R#25: expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224, 0.092,
0.138, 0.15, 0.22, 0.05), names))
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/test_MAVF_scores.R#18: test_that("MAVF_scores provides proper messages and warnings",
{
expect_error(MAVF_Scores(SAVF_matrix, weights, names))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(MAVF_scores(SAVF_matrix, weights2, names))
expect_error(MAVF_scores(SAVF_matrix, weights = SAVF_matrix,
names))
expect_error(MAVF_Scores(SAVF_matrix[, 1:6], weights,
names))
expect_error(MAVF_Scores(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder")))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names))
expect_warning(MAVF_Scores(SAVF_matrix, c(0.096, 0.224,
0.092, 0.155, 0.175, 0.228, 0.15), names))
expect_error(MAVF_Scores(SAVF_matrix, c("0.096", "0.224",
"0.092", "0.138", "0.152", "0.228", "0.07"), names))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x60cac08>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_score
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::MAVF_Scores(...)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval_bare(expr, quo_get_env(quo))
where 3: quasi_label(enquo(object), label, arg = "object")
where 4 at testthat/test_MAVF_scores.R#33: expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
where 5: eval(code, test_env)
where 6: eval(code, test_env)
where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 11: doTryCatch(return(expr), name, parentenv, handler)
where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 13: tryCatchList(expr, classes, parentenv, handlers)
where 14: 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 15: test_code(desc, code, env = parent.frame())
where 16 at testthat/test_MAVF_scores.R#32: test_that("MAVF_scores has correct dimensions and output type",
{
expect_is(MAVF_Scores(SAVF_matrix, weights, names), "data.frame")
expect_length(MAVF_Scores(SAVF_matrix, weights, names),
2)
})
where 17: eval(code, test_env)
where 18: eval(code, test_env)
where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 23: doTryCatch(return(expr), name, parentenv, handler)
where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 25: tryCatchList(expr, classes, parentenv, handlers)
where 26: 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 27: test_code(NULL, exprs, env)
where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 29: force(code)
where 30: doWithOneRestart(return(expr), restart)
where 31: withOneRestart(expr, restarts[[1L]])
where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 33: 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 34: FUN(X[[i]], ...)
where 35: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 36: force(code)
where 37: doWithOneRestart(return(expr), restart)
where 38: withOneRestart(expr, restarts[[1L]])
where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 42: 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 43: 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 44: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x60cac08>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scor
the condition has length > 1
Backtrace:
1. testthat::expect_is(...)
4. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: MAVF_Scores(SAVF_matrix, weights, names)
where 2: as.matrix(MAVF_Scores(SAVF_matrix, weights, names))
where 3: eval_bare(expr, quo_get_env(quo))
where 4: quasi_label(enquo(object), label, arg = "object")
where 5 at testthat/test_MAVF_scores.R#50: expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
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_MAVF_scores.R#49: test_that("MAVF_Scores computes correctly", {
expect_equivalent(as.matrix(MAVF_Scores(SAVF_matrix, weights,
names)), as.matrix(test1answer))
})
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: 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 = 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 35: FUN(X[[i]], ...)
where 36: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 37: force(code)
where 38: doWithOneRestart(return(expr), restart)
where 39: withOneRestart(expr, restarts[[1L]])
where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 43: 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 44: 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 45: test_check("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0x60cac08>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50) ──────────
the condition has length > 1
Backtrace:
1. testthat::expect_equivalent(...)
5. DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights2, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights2, names, 4)
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/test_sensitivity_plot.R#21: expect_error(sensitivity_plot(SAVF_matrix, weights2, names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x60782d0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights = SAVF_matrix, names, 4)
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/test_sensitivity_plot.R#22: expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x60782d0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix[, 1:6], weights, names, 4)
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/test_sensitivity_plot.R#23: expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights, names,
4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x60782d0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy", "Blaine Gabbert",
"Christian Ponder"), 4)
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/test_sensitivity_plot.R#24: expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x60782d0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: sensitivity_plot(SAVF_matrix, c(0.096, 0.224, 0.092, 0.138, 0.15,
0.22, 0.05), names, 4)
where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
where 3: withCallingHandlers(code, warning = function(condition) {
out$push(condition)
maybe_restart("muffleWarning")
})
where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)),
...)
where 5: quasi_capture(enquo(object), label, capture_warnings)
where 6 at testthat/test_sensitivity_plot.R#25: expect_warning(sensitivity_plot(SAVF_matrix, c(0.096, 0.224,
0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
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/test_sensitivity_plot.R#18: test_that("sensitivity_plot provides proper messages and warnings",
{
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
4))
SAVF_matrix <- as.matrix(SAVF_matrix)
expect_error(sensitivity_plot(SAVF_matrix, weights2,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights = SAVF_matrix,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix[, 1:6], weights,
names, 4))
expect_error(sensitivity_plot(SAVF_matrix, weights, c("Greg McElroy",
"Blaine Gabbert", "Christian Ponder"), 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.138, 0.15, 0.22, 0.05), names, 4))
expect_warning(sensitivity_plot(SAVF_matrix, c(0.096,
0.224, 0.092, 0.155, 0.175, 0.228, 0.15), names,
4))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
"4"))
expect_error(sensitivity_plot(SAVF_matrix, weights, names,
9))
})
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("DecisionAnalysis")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names, criteria, title = TRUE)
{
Names <- dplyr::quo(Names)
Weight <- dplyr::quo(Weight)
Value <- dplyr::quo(Value)
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
if ((class(criteria) != "numeric") | (criteria > nrow(SAVF_matrix))) {
stop("criteria must be a column number of the SAVF_Matrix")
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
i <- criteria
x <- seq(0, 1, by = 0.1)
m <- matrix(NA, nrow = length(weights), ncol = 11)
m <- sapply(1:length(weights), function(j) m[j, ] <- (1 -
x) * (weights[j]/(1 - weights[i])))
m <- t(m)
m[i, ] <- x
M <- data.frame(MAVF_Scores(SAVF_matrix, m, names))
names(M) <- c("Names", x)
`%>%` <- dplyr::`%>%`
M %>% tidyr::gather(Weight, Value, -c(1)) %>% ggplot2::ggplot(ggplot2::aes(x = as.numeric(Weight),
y = Value, group = Names, colour = Names)) + ggplot2::geom_line() +
ggplot2::geom_vline(xintercept = weights[i]) + ggplot2::ylab("MAVF Score") +
ggplot2::xlab("Weight") + if (title == TRUE) {
ggplot2::labs(title = colnames(SAVF_matrix)[criteria])
}
}
<bytecode: 0x60782d0>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function sensitivity_plot in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
── 5. Error: sensitivity_plot provides proper messages and warnings (@test_sensi
the condition has length > 1
Backtrace:
1. testthat::expect_warning(...)
6. DecisionAnalysis::sensitivity_plot(...)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 63 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 5 ]
1. Error: MAVF_breakout provides proper messages and warnings (@test_MAVF_breakout.R#25)
2. Error: MAVF_scores provides proper messages and warnings (@test_MAVF_scores.R#25)
3. Error: MAVF_scores has correct dimensions and output type (@test_MAVF_scores.R#33)
4. Error: MAVF_Scores computes correctly (@test_MAVF_scores.R#50)
5. Error: sensitivity_plot provides proper messages and warnings (@test_sensitivity_plot.R#25)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc
Version: 1.0.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
--- re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’ using rmarkdown
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'gridExtra'
The following object is masked from 'package:dplyr':
combine
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
DecisionAnalysis
--- call from context ---
DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
--- call from argument ---
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
--- R stacktrace ---
where 1: DecisionAnalysis::MAVF_Scores(SAVF_matrix, weights, names)
where 2: eval(expr, envir, enclos)
where 3: eval(expr, envir, enclos)
where 4: withVisible(eval(expr, envir, enclos))
where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
error = eHandler, message = mHandler)
where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 8: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
where 9: evaluate::evaluate(...)
where 10: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options))
where 11: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options)))
where 12: block_exec(params)
where 13: call_block(x)
where 14: process_group.block(group)
where 15: process_group(group)
where 16: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
where 17: process_file(text, output)
where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
output_dir = getwd(), ...)
where 20: vweave_rmarkdown(...)
where 21: engine$weave(file, quiet = quiet, encoding = enc)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: tryCatch({
engine$weave(file, quiet = quiet, encoding = enc)
setwd(startdir)
output <- find_vignette_product(name, by = "weave", engine = engine)
if (!have.makefile && vignette_is_tex(output)) {
texi2pdf(file = output, clean = FALSE, quiet = quiet)
output <- find_vignette_product(name, by = "texi2pdf",
engine = engine)
}
outputs <- c(outputs, output)
}, error = function(e) {
thisOK <<- FALSE
fails <<- c(fails, file)
message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
file, conditionMessage(e)))
})
where 26: tools:::buildVignettes(dir = "/data/gannet/ripley/R/packages/tests-devel/DecisionAnalysis.Rcheck/vign_test/DecisionAnalysis",
ser_elibs = "/tmp/RtmpA24NQ6/file1c9b34f7d80c.rds")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (SAVF_matrix, weights, names)
{
if (class(SAVF_matrix) != "matrix") {
stop("SAVF_matrix must be a matrix\n", "You have provided an object of the following class:\n",
"SAVF_matrix: ", class(SAVF_matrix), "\n")
}
if (class(weights) != "matrix") {
if (class(weights) != "numeric") {
stop("weights must be of class numeric\n", "You have provided an object of the following class:\n",
"weights: ", class(weights))
}
if (sum(weights) < 1) {
warning("The sum of weights is less than 1")
}
if (sum(weights) > 1) {
warning("The sum of weights is greater than 1")
}
if (ncol(SAVF_matrix) != length(weights)) {
stop("The number of columns in the SAVF matrix must equal the length of the vector of weights")
}
if (nrow(SAVF_matrix) != length(names)) {
stop("The number of rows in the SAVF matrix must equal the length of the vector of names")
}
}
SAVF_matrix[is.na(SAVF_matrix)] <- 0
MAVF = SAVF_matrix %*% weights
value <- data.frame(names, MAVF)
names(value) <- c("Name", "Score")
value <- value[order(value$Score, decreasing = TRUE), ]
return(value)
}
<bytecode: 0xb654d98>
<environment: namespace:DecisionAnalysis>
--- function search by body ---
Function MAVF_Scores in namespace DecisionAnalysis has this body.
----------- END OF FAILURE REPORT --------------
Quitting from lines 188-203 (MultiObjectiveDecisionAnalysisinR.Rmd)
Error: processing vignette 'MultiObjectiveDecisionAnalysisinR.Rmd' failed with diagnostics:
the condition has length > 1
--- failed re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’
SUMMARY: processing the following file failed:
‘MultiObjectiveDecisionAnalysisinR.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc
Version: 1.0.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
...
--- re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’ using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'gridExtra'
The following object is masked from 'package:dplyr':
combine
Quitting from lines 84-97 (MultiObjectiveDecisionAnalysisinR.Rmd)
Error: processing vignette 'MultiObjectiveDecisionAnalysisinR.Rmd' failed with diagnostics:
there is no package called 'webshot'
--- failed re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’
SUMMARY: processing the following file failed:
‘MultiObjectiveDecisionAnalysisinR.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-patched-solaris-x86
Version: 1.0.0
Check: re-building of vignette outputs
Result: WARN
Error(s) in re-building vignettes:
--- re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’ using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'gridExtra'
The following object is masked from 'package:dplyr':
combine
Quitting from lines 84-97 (MultiObjectiveDecisionAnalysisinR.Rmd)
Error: processing vignette 'MultiObjectiveDecisionAnalysisinR.Rmd' failed with diagnostics:
cannot open the connection
--- failed re-building ‘MultiObjectiveDecisionAnalysisinR.Rmd’
SUMMARY: processing the following file failed:
‘MultiObjectiveDecisionAnalysisinR.Rmd’
Error: Vignette re-building failed.
Execution halted
Flavor: r-release-osx-x86_64
Version: 1.0.0
Check: re-building of vignette outputs
Result: WARN
Error in re-building vignettes:
...
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Attaching package: 'gridExtra'
The following object is masked from 'package:dplyr':
combine
Quitting from lines 84-97 (MultiObjectiveDecisionAnalysisinR.Rmd)
Error: processing vignette 'MultiObjectiveDecisionAnalysisinR.Rmd' failed with diagnostics:
cannot open the connection
Execution halted
Flavor: r-oldrel-osx-x86_64