r-lib / vctrs

Generic programming with typed R vectors
https://vctrs.r-lib.org
Other
285 stars 66 forks source link

Error in `vctrs::vec_locate_matches()`: #1948

Open nevesjcg opened 1 month ago

nevesjcg commented 1 month ago

recipe_spec <- (train) %>%

  • update_role(rowid, country, year, new_role = "indicator") %>%
  • update_role(PS, A, S, PD, U, PG, E, P, PH, ES, new_role = "predictor") %>%
  • update_role(gdp, gini, inflation, new_role = "outcome") Error in vctrs::vec_locate_matches(): ! Unsupported vctrs type null. ℹ In file type-info.c at line 189. ℹ Install the winch package to get additional debugging info the next time you get this error. ℹ This is an internal error that was detected in the vctrs package. Please report it at https://github.com/r-lib/vctrs/issues with a reprex and the full backtrace. Backtrace: ▆
    1. ├─... %>% ...
    2. ├─recipes::update_role(., gdp, gini, inflation, new_role = "outcome")
    3. ├─recipes::update_role(., PS, A, S, PD, U, PG, E, P, PH, ES, new_role = "predictor")
    4. ├─recipes::update_role(., rowid, country, year, new_role = "indicator")
    5. │ └─recipes::recipes_eval_select(terms, data, info, check_case_weights = FALSE)
    6. │ └─vctrs::vec_locate_matches(names(data), info$variable, no_match = "error")
    7. └─rlang:::stop_internal_c_lib(...)
    8. └─rlang::abort(message, call = call, .internal = TRUE, .frame = frame) Warning messages: 1: Unknown or uninitialised column: template. 2: Unknown or uninitialised column: var_info.
DavisVaughan commented 1 month ago

Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.

If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page.

You can install reprex by running (you may already have it, though, if you have the tidyverse package installed):

install.packages("reprex")

Thanks