更新时间:2023-09-30 16:22:28
library(devtools)
#' Update all github installed packages.
#'
#' This will trash any non-master branch installs, and spend time re-installing
#' packages which are already up-to-date.
update_github <- function() {
pkgs = loadedNamespaces()
print(pkgs)
desc <- lapply(pkgs, packageDescription, lib.loc = NULL)
for (d in desc) {
message("working on ", d$Package)
if (!is.null(d$GithubSHA1)) {
message("Github found")
install_github(repo = d$GithubRepo, username = d$GithubUsername)
}
}
}
# test it:
# install github version of tidyr
install_github("hadley/tidyr")
library(tidyr)
update_github()
如果您安装的github安装比user/repo的master分支更复杂,请不要运行它.如果您有很多github安装,也要小心,因为这会盲目地将它们全部重新安装,即使是最新的.这可能会花费很长时间,并且如果github master分支没有处于***状态,也可能会破坏工作包.
Don't run this if you have any github installations from anything more complicated than the master branch of user/repo. Also be careful if you have a lot of github installations, since this will blindly reinstall them all, even if up-to-date. This could take a long time, and also might break working packages if github master branches are not in tip top condition.
有关详细信息,请查看devtools R/session_info.r
.
Take a look at devtools R/session_info.r
for details.