Skip to content

Commit 2f1836c

Browse files
committed
more work on outcome classes that aren't valid colnames
surfaced in revdepchecks: the previous approach worked for when disallowed characters are later on in the colname, but not when the entry is prefixed by a number. e.g. if `levels(outcome) == c(0, 1)`
1 parent 14594d6 commit 2f1836c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/add_candidates.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ collate_predictions <- function(x) {
506506

507507
# given a set of candidate columns, removes those with hard class predictions
508508
remove_class_preds <- function(x) {
509-
lvls <- make.names(levels(factor(x[[1]])))
509+
lvls <- make.names(paste0(".prefix.", levels(factor(x[[1]]))))
510+
lvls <- gsub(".prefix.", "", lvls, fixed = TRUE)
510511

511512
# gather indices for the columns with class probability predictions
512513
prob_preds_idx <- purrr::map(paste0(".pred_", lvls), grepl, x = colnames(x)) %>%

0 commit comments

Comments
 (0)