1 |
tree |
|
pars |
|
parallel |
|
n_trees |
|
WT |
|
method |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (tree, pars, parallel = F, n_trees, WT = FALSE, method = 1)
{
if (parallel) {
no_cores <- detectCores() - 1
cl <- makeCluster(no_cores)
registerDoParallel(cl)
trees <- foreach(i = 1:n_trees, combine = list) %dopar%
dmea02::rec.tree(tree = tree, pars = pars)
stopCluster(cl)
}
else {
trees = vector("list", length = n_trees)
for (i in 1:n_trees) {
if (method == 1)
rec = rec.tree(tree = tree, pars = pars)
if (method == 2)
rec = rec.tree2(tree = tree, pars = pars)
if (WT) {
trees[[i]] = rec$wt
}
else {
trees[[i]] = rec
}
}
}
return(trees)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.