largeRCRF/man/saveForest.Rd

38 lines
1,023 B
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/saveForest.R
\name{saveForest}
\alias{saveForest}
\title{Save Random Forests}
\usage{
saveForest(forest, directory, overwrite = FALSE)
}
\arguments{
\item{forest}{The forest to save.}
\item{directory}{The directory that should be created to save the trees in.
Note that if the directory already exists, an error will be displayed
unless \code{overwrite} is set to TRUE.}
\item{overwrite}{Should the function overwrite an existing forest; FALSE by
default.}
}
\description{
Saves a random forest for later use, given that the base R
\code{\link{base::save}} function doesn't work for this package.
}
\examples{
# Regression Example
x1 <- rnorm(1000)
x2 <- rnorm(1000)
y <- 1 + x1 + x2 + rnorm(1000)
data <- data.frame(x1, x2, y)
forest <- train(y ~ x1 + x2, data,
ntree=100, numberOfSplits = 5, mtry = 1, nodeSize = 5)
saveForest(forest, "trees")
new_forest <- loadForest("trees")
}
\seealso{
\code{\link{train}}, \code{\link{loadForest}}
}