Instruction: Explain the process of tuning hyperparameters for a machine learning model in R, including the use of caret or tidymodels.
Context: This question tests the candidate's ability to optimize machine learning models in R, a key competency for developing accurate predictive models.