## TODO: add metadata
run_task_install <- function(state, task) {
pkgidx <- task$args$pkgidx
pkg <- state$plan$package[pkgidx]
version <- state$plan$version[pkgidx]
filename <- state$plan$file[pkgidx]
lib <- state$config$lib
metadata <- state$plan$metadata[[pkgidx]]
state$plan$build_done[[pkgidx]] <- TRUE
state$plan$build_time[[pkgidx]] <- na_difftime()
state$plan$build_error[[pkgidx]] <- NA
state$plan$build_stdout[[pkgidx]] <- NA_character_
state$plan$build_stderr[[pkgidx]] <- NA_character_
state$plan$install_time[[pkgidx]] <- Sys.time()
safe_install_packages(
filename,
lib = lib,
repos = NULL,
quiet = FALSE,
type = "source"
)
time <- Sys.time() - state$plan$install_time[[pkgidx]]
state$plan$install_done[[pkgidx]] <- TRUE
state$plan$install_time[[pkgidx]] <- time
state$plan$install_error[[pkgidx]] <- FALSE
state$plan$install_stdout[[pkgidx]] <- stdout
state$plan$install_stderr[[pkgidx]] <- stderr
state$plan$deps_left <- lapply(state$plan$deps_left, setdiff, pkg)
state
}
safe_install_packages <- function(lib, ...) {
env_lib <- paste(c(lib, .libPaths()), collapse = .Platform$path.sep)
with_envvar(
c(R_LIBS = env_lib,
R_LIBS_USER = env_lib,
R_LIBS_SITE = env_lib),
utils::install.packages(lib = lib, ...)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.