Understanding and Implementing Random Forests in R: A Comprehensive Guide