RANDOMFOREST: Classification using Random Forest

RANDOMFORESTR Documentation

Classification using Random Forest

Description

This function builds a classification model using Random Forest

Usage

RANDOMFOREST(
  train,
  labels,
  ntree = 500,
  nvar = if (!is.null(labels) && !is.factor(labels)) max(floor(ncol(train)/3), 1) else
    floor(sqrt(ncol(train))),
  tune = FALSE,
  methodparameters = NULL,
  graph = FALSE,
  seed = NULL,
  ...
)

Arguments

train

The training set (description), as a data.frame.

labels

Class labels of the training set (vector or factor).

ntree

The number of trees in the forest.

nvar

Number of variables randomly sampled as candidates at each split.

tune

If true, the function returns parameters instead of a classification model.

methodparameters

Present for interface consistency with performance (which always passes it when fitting a model). Currently unused: RANDOMFOREST does not yet implement hyperparameter tuning, so tune = TRUE returns an empty params object and there is nothing for methodparameters to override.

graph

Present for interface consistency with performance (which always passes it when fitting a model). Currently unused: RANDOMFOREST does not produce a plot.

seed

A specified seed for random number generation (bootstrap sampling of the trees and, when nvar is smaller than the total number of variables, the candidate variables drawn at each split).

...

Other parameters, forwarded to randomForest.

Value

The classification model.

See Also

randomForest

Examples


require (datasets)
data (iris)
RANDOMFOREST (iris [, -5], iris [, 5])


fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.