# NOT RUN {
library(forestRK)
x.train <- x.organizer(iris[,1:4], encoding = "num")[c(1:25,51:75,101:125),]
y.train <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.new
# random forest
# min.num.obs.end.node.tree is set to 5 by default;
# entropy is set to TRUE by default
# normally nbags and samp.size have to be much larger than 30 and 50
forestRK.1 <- forestRK(x.train, y.train, nbags = 30, samp.size = 50)
# prediction from a random forest RK
covariate.used.for.split.tree <- var.used.forestRK(forestRK.1,
tree.index=c(4,5,6))
# retrieve the list of covariates used for splitting for the 'tree #6'
covariate.used.for.split.tree[["6"]]
# }
Run the code above in your browser using DataLab