Skip to content

Instantly share code, notes, and snippets.

@florianhartig
Last active June 15, 2022 08:29
Show Gist options
  • Select an option

  • Save florianhartig/10527319 to your computer and use it in GitHub Desktop.

Select an option

Save florianhartig/10527319 to your computer and use it in GitHub Desktop.
Script to copy the packages installed on one computer or R version to another. Originally from http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r-on-windows
# modified from http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r-on-windows
# run on old computer / r version
setwd("/Users/Florian/Dropbox/temp") # or any other existing temp directory
packages <- installed.packages()[,"Package"]
save(packages, file="Rpackages")
# run on new computer / r version
setwd("/Users/Florian/Dropbox/temp") # or any other existing temp directory
load("Rpackages")
for (p in setdiff(packages, installed.packages()[,"Package"]))
install.packages(p)
@florianhartig

Copy link
Copy Markdown
Author

OK, I will look at this, thanks for the hint!

@ML33M

ML33M commented Aug 27, 2021

Copy link
Copy Markdown

Thank you for sharing this

ghost commented Jun 12, 2022

Copy link
Copy Markdown

Thanks!

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