Skip to content
Snippets Groups Projects
Commit 8075776f authored by Nathalie Vialaneix's avatar Nathalie Vialaneix
Browse files

improved stop messages

parent c7c6d696
No related branches found
No related tags found
No related merge requests found
......@@ -146,23 +146,27 @@ plot_selection <- function(x, sel.type, threshold) {
is_selected <- "selected" %in% names(x)
if (threshold != "none") {
if (!is.numeric(threshold)) stop("'threshold' must be numeric.")
if (!is.numeric(threshold))
stop("'threshold' must be numeric.", call. = FALSE)
if (is_selected)
stop(paste("A selection method has already been used: 'threshold' must",
"be 'none'."))
"be 'none'."),
call. = FALSE)
if (sel.type != "selection") {
warning(paste("A 'threshold' has passed to the plot function while",
"'sel.type' is not 'selection'. Automatically switching it",
"to 'selection'."))
"to 'selection'."),
call. = FALSE)
sel.type <- "selection"
}
}
if (sel.type == "selection" && !is_selected && threshold == "none")
stop(paste("Variable selection was not used on this result. Choose",
"sel.type = 'importance'"))
"sel.type = 'importance'"),
call. = FALSE)
lobj <- length(x$importances)
nrepeats <- nrow(x$mse) / lobj
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment