R小技巧汇总

 

一个R lib文件夹,最好就装一个版本的R packages,因为不同版本存在兼容性问题。

偶然间我把新版本装到了旧版本里,产生了兼容性问题。

用以下代码重装就行

GPT神器,问题如下:

  • how to list R package that build under specific version of R?
  • how to reinstall these packages?
installed <- installed.packages()
built_under <- installed[installed[, "Built"] == "4.4.1", ]
built_under[, c("Package", "Built")]

specific_version <- installed[installed[, "Built"] == "4.4.1", ]
packages_to_reinstall <- specific_version[, "Package"]

install.packages(packages_to_reinstall)

  

posted @ 2024-11-20 03:50  Life·Intelligence  阅读(4)  评论(0编辑  收藏  举报
TOP