Everytime I upgrade R using homebrew I need to install most packages again

前端 未结 3 1061
醉酒成梦
醉酒成梦 2021-02-15 18:35

R Packages are installed to /usr/local/Cellar/r/3.1.2_1/R.framework/Versions/3.1/Resources/library

Whenever I run brew upgrade r and the versio

3条回答
  •  逝去的感伤
    2021-02-15 19:14

    1. Save a list of your packages as an R data file

      tmp <- installed.packages() installedpkgs <- as.vector(tmp[is.na(tmp[,"Priority"]), 1]) save(installedpkgs, file="installed_old.rda")

    2. Install new version

    3. Load the list, then download the old packages from CRAN

      oad("installed_old.rda") tmp <- installed.packages() installedpkgs.new <- as.vector(tmp[is.na(tmp[,"Priority"]), 1]) missing <- setdiff(installedpkgs, installedpkgs.new) install.packages(missing) update.packages()

提交回复
热议问题