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) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.