Skip to content

Instantly share code, notes, and snippets.

@MarkZhangTW
Created November 28, 2019 06:31
Show Gist options
  • Select an option

  • Save MarkZhangTW/7bf68df40a9cb09a399379fa2dd48dad to your computer and use it in GitHub Desktop.

Select an option

Save MarkZhangTW/7bf68df40a9cb09a399379fa2dd48dad to your computer and use it in GitHub Desktop.
detach all required packages in R
for (package in sessionInfo()$otherPkgs)
detach(paste0('package:', package$Package), character.only = TRUE)
# or
lapply(X = sessionInfo()$otherPkgs, FUN = function(package)
{ detach(paste0('package:', package$Package), character.only = TRUE)})
@MarkZhangTW
Copy link
Copy Markdown
Author

MarkZhangTW commented Oct 13, 2020

installed.packages()[,c("Package", "Version")]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment