Learn R Programming

mlspatial (version 0.1.1)

train_rf: Train Random Forest model

Description

Trains a Random Forest regression model.

Usage

train_rf(data, formula, ntree = 500, seed = 123)

Value

A trained randomForest model object.

Arguments

data

A data frame containing the training data.

formula

A formula describing the model structure.

ntree

Number of trees to grow (default 500).

seed

Random seed for reproducibility (default 123).

Examples

Run this code
# \donttest{
library(randomForest)
data(mtcars)
rf_model <- train_rf(mtcars, mpg ~ cyl + hp + wt, ntree = 100)
print(rf_model)
# }

Run the code above in your browser using DataLab