When reviewing #994 I noticed that we have outcome_names() with methods for different objects and also .get_tune_outcome_names() (as part of various .get_tune_*() functions).
We can consolidate .get_tune_outcome_names() with outcome_names.tune_results():
|
#' @export |
|
#' @rdname outcome_names |
|
outcome_names.tune_results <- function(x, ...) { |
|
att <- attributes(x) |
|
if (any(names(att) == "outcomes")) { |
|
res <- att$outcomes |
|
} else { |
|
res <- NA_character_ |
|
} |
|
res |
|
} |
|
#' @export |
|
#' @rdname tune_accessor |
|
.get_tune_outcome_names <- function(x) { |
|
x <- attributes(x) |
|
if (any(names(x) == "outcomes")) { |
|
res <- x$outcomes |
|
} else { |
|
res <- character(0) |
|
} |
|
res |
|
} |
When reviewing #994 I noticed that we have
outcome_names()with methods for different objects and also.get_tune_outcome_names()(as part of various.get_tune_*()functions).We can consolidate
.get_tune_outcome_names()withoutcome_names.tune_results():tune/R/outcome-names.R
Lines 53 to 63 in a8f0c05
tune/R/utils.R
Lines 208 to 218 in a8f0c05