R/combine_preds.R

Defines functions combine_preds

Documented in combine_preds

#' Combine predictions from models into one dataframe
#' @importFrom dplyr mutate bind_rows
#' @export

combine_preds <- function(rf_preds,
                          boost_preds,
                          glm_preds,
                          lasso_preds,
                          ridge_preds) {
  rf_preds$model_name <- "Random forest"
  boost_preds$model_name <- "XGboost"
  glm_preds$model_name <- "Logistic regression"
  lasso_preds$model_name <- "LASSO regression"
  ridge_preds$model_name <- "Ridge regression"

  bind_rows(
    rf_preds,
    boost_preds,
    glm_preds,
    lasso_preds,
    ridge_preds
  ) %>%
    mutate(outcome = ifelse(long == "long", 1, 0))
}
awconway/capnopred documentation built on Dec. 15, 2021, 5:01 a.m.