Description Usage Arguments Details Note Author(s) See Also Examples
Detaches non standard packages for a (fairly) clean initialization at the start of an interactive script.
1 2 3 4 5 6 | detach_nonstandard_namespaces(
standard_packages = c("stats", "graphics", "grDevices", "utils", "datasets",
"methods", "base"),
standard_namespaces = c("tools", "Rcpp", "data.table", "reshape2", "stringr", "plyr"),
maxiter = 20
)
|
standard_packages |
Vector of packages considered to be "standard" and not detached. The default value is c('stats', 'graphics', 'grDevices', 'utils', 'datasets', 'methods', 'base', 'tools', 'Rcpp') Although Rcpp isn't "standard", it can't be detached. |
standard_namespaces |
Vector of standard namepaces NOT IMPLEMENTED These are namespaces that you want to keep, if you are detaching namespaces; i.e. (if detach_namespaces == TRUE) The default value is c('tools', 'Rcpp', 'data.table') |
maxiter |
How many times deep do you want to try and detach name spaces? This is to avoid an infinite recursion problem. Default value is 20 |
See the details in detach_nonstandard_packages
The best way to detach namespaces is to restart R, which in R Studio is quite easy; just select your current project again in the upper right hand corner of the application and you'll be back where you were with a clean R instance.
To see the full list of attached namespaces and pacakges run
sessionInfo()
. Load some pacakges first to see a decent example,
such as ggplot2, data.table, or caret.
Gene Leynes and Scott Rodgers
sessionInfo
loadedNamespaces
detach_nonstandard_packages
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
##----------------------------------------------------------------------
## Initialize a script by removing all packages and deleting all objects
##----------------------------------------------------------------------
library(geneorama)
rm(list=ls())
detach_nonstandard_packages()
## Really, I wouldn't run this:
# detach_nonstandard_namespaces()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.