Automate hyperparameter optimization in R caret by passing a pre-defined data frame to the tuneGrid argument within the train function.