% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coercion.R
\name{as.party.e2tree}
\alias{as.party.e2tree}
\title{Convert an E2Tree Object to partykit Format}
\usage{
as.party.e2tree(x, ...)
}
\arguments{
\item{x}{An e2tree object.}

\item{...}{Additional arguments (ignored).}
}
\value{
A \code{party} object (from \pkg{partykit}).
}
\description{
Coerces an \code{e2tree} object into a \code{party} object from the
\pkg{partykit} package. This enables the use of partykit's infrastructure
for printing, plotting, and predicting with the E2Tree model.
}
\examples{
\donttest{
data(iris)
smp_size <- floor(0.75 * nrow(iris))
train_ind <- sample(seq_len(nrow(iris)), size = smp_size)
training <- iris[train_ind, ]

ensemble <- randomForest::randomForest(Species ~ ., data = training,
  importance = TRUE, proximity = TRUE)
D <- createDisMatrix(ensemble, data = training, label = "Species",
  parallel = list(active = FALSE, no_cores = 1))
setting <- list(impTotal = 0.1, maxDec = 0.01, n = 2, level = 5)
tree <- e2tree(Species ~ ., training, D, ensemble, setting)

if (requireNamespace("partykit", quietly = TRUE)) {
  party_obj <- partykit::as.party(tree)
  plot(party_obj)
}
}

}
\seealso{
\code{\link{as.rpart.e2tree}} for conversion to rpart format.
}
\keyword{internal}
