I am using tidymodels with a step_mutate() function where I compute age:
step_mutate(age = as.numeric((ymd("2022-12-31") - dob)/365.25))
It works fine when used in a simple workflow where I fit a logistic regression, but when I try to fit a lasso model, it returns the "All models failed" message, and in the notes, it says, "Error in dplyr::mutate()
:\n! Problem while computing age = as.numeric((ymd("2022-12-31") -\n dob)/365.25)
.\nCaused by error in ymd()
:\n! could not find function "ymd"". I have loaded the lubridate package and, again, this works when I use the fit() function, just not when using tune_grid() with a cross validation data.
I can't provide a reprex with the current data I'm using, but could do that with other data, if needed. For now, I will use step_date() to find the year and then compute age without using the ymd function.