Skip to content

Instantly share code, notes, and snippets.

@arne-cl
Created September 16, 2014 08:46
Show Gist options
  • Select an option

  • Save arne-cl/b7f88b0f1590bd68b29b to your computer and use it in GitHub Desktop.

Select an option

Save arne-cl/b7f88b0f1590bd68b29b to your computer and use it in GitHub Desktop.

Revisions

  1. arne-cl created this gist Sep 16, 2014.
    10 changes: 10 additions & 0 deletions restore_packages.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # restore_packages.R
    #
    # installs each package from the stored list of packages
    # source: http://hlplab.wordpress.com/2012/06/01/transferring-installed-packages-between-different-installations-of-r/

    load("~/installed_packages.rda")

    for (count in 1:length(installedpackages)) {
    install.packages(installedpackages[count])
    }
    8 changes: 8 additions & 0 deletions store_packages.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # store_packages.R
    #
    # stores a list of your currently installed packages
    # source: http://hlplab.wordpress.com/2012/06/01/transferring-installed-packages-between-different-installations-of-r/

    tmp = installed.packages()
    installedpackages = as.vector(tmp[is.na(tmp[,"Priority"]), 1])
    save(installedpackages, file="~/installed_packages.rda")