Description Usage Arguments Details Examples
Some packages would load with itself some other package depedency into the search path. In order to eliminate the possibility of conflict and avoid side effect in writing functions, it is recommended to remove additional packages from the search path after the calculation.
1 | unload_extra_library(init_state = init_state)
|
init_state |
A list of character vectors containing the information of previous state of search path. |
This is also a dirty trick to remove extra packages from search path when you are writing a package and some functions from other packages you use have implicit or ill-documented depedencies so that you have to use require or library somewhere in your code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | init_state=search()
testing_packs=function(data){
library(caret)
library(doParallel)
library(foreach)
library(magrittr)
library(smotefamily)
library(FNN)
library(dbscan)
library(ROSE)
library(DMwR)
library(h2o)
library(dplyr)
library(glue)
library(MLmetrics)
library(testthat)
return(1)
}
testing_packs(data=iris)
unload_extra_library(init_state=init_state)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.