Skip to content

Commit 3b49cba

Browse files
committed
Make explain_forest() invariant to template extension
1 parent 812d129 commit 3b49cba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/explain_forest.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ explain_forest <- function(forest, interactions = FALSE, data = NULL, vars = NUL
3434
environment$pred_grid <- pred_grid
3535
environment$measures <- measures
3636
directory <- getwd()
37-
rmarkdown::render(paste0(path.package("randomForestExplainer"), "/templates/Explain_forest_template.rmd"),
37+
path_to_templates <- file.path(path.package("randomForestExplainer"), "templates")
38+
template_name <- grep('explain_forest_template.rmd', list.files(path_to_templates),
39+
ignore.case = TRUE, value = TRUE)
40+
41+
rmarkdown::render(file.path(path_to_templates, template_name),
3842
"html_document", output_file = paste0(directory, "/Your_forest_explained.html"),
3943
envir = environment)
4044
}

0 commit comments

Comments
 (0)