R/update_github_pkgs.R

Defines functions update_github_pkgs

Documented in update_github_pkgs

#' Update Packages from Github
#' @export
#' @description Updates packages that have been installed from public Github repositories

update_github_pkgs <- function() {
  check <- "SKTools" %in% .packages()
  if (check) {
    detach("package:SKTools", unload = TRUE)
  }
  utils::installed.packages() %>%
    tibble::as_tibble() %>%
    .$Package %>%
    purrr::set_names() %>%
    purrr::map(utils::packageDescription) %>%
    purrr::map(~ paste0(.$GithubUsername, "/", .$GithubRepo)) %>%
    purrr::map_if(nchar(.) > 3, purrr::safely(~ devtools::install_github(.)))
  if (check) {
    library("SKTools")
  }
}
samuelkaminsky/SKTools documentation built on Jan. 2, 2021, 4:06 a.m.