library(randomForest) rf.model <- randomForest(formula = y ~ ., mtry = 4, nodesize = 3, sampsize = 5000, data = your_data)