knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(pkginstallgh)

temp_path <- file.path(tempdir(), "gt_folder")
unlink(temp_path, recursive = TRUE)
dir.create(temp_path)
lib_path <-.libPaths()
.libPaths()
.libPaths(c(lib_path, temp_path))
.libPaths()

if (curl::has_internet()) {
  # # getting dependencies of gt
  # curl::curl_download(
  #   "https://raw.githubusercontent.com/rstudio/gt/master/DESCRIPTION",
  #   destfile = file.path(tempdir(), "gtDESCRIPTION")
  # )
  # pkgs <- desc::desc_get_deps(file = file.path(tempdir(), "gtDESCRIPTION")) 
  # pkgs <- pkgs[pkgs$type %in% c("Depends", "Imports"), ]
  # pkgs <- setdiff(pkgs$package, "R")
  # 
  # # installing deps
  # install.packages(pkgs, lib = temp_path, repos = "https://cran.rstudio.com/")
  # installing gt
  remotes::install_github("rstudio/gt", lib = temp_path)

  gt::gt(mtcars)

}


ddsjoberg/pkginstallgh documentation built on Nov. 5, 2019, 2:27 p.m.