Is there a straightforward way to check if a recipe has any parameters set to tune()? The best I can find right now is to try to prep() the recipe and check the error message . . . I checked a bit into the error message that generates and I see that there is, somewhere in some package and apparently not exported an is_tune function, perhaps I can copy that to my environment if someone knows where it is?
This is working for me but feels . . . like the wrong way to handle the situation. What if prep involves a lot of computation (e.g.)?
check_if_needs_tune<-function(recipe_to_check){
tryCatch({prep(recipe_to_check)
FALSE},error=function(e) {
if(grepl("Argument(s) with `tune()`:",e$message,fixed=T))
return(TRUE) })
}