#' @importFrom remotes download_version
#' @export
download_cran_package_source <- function(package, version = NULL, dest_dir = NULL,
repos = getOption("repos")) {
archive <- remotes::download_version(package, version, repos)
on.exit(unlink(archive))
utils::untar(archive, exdir = dest_dir)
dir <- file.path(dest_dir, package)
if (!dir.exists(dir)) {
stop("Expected extracted sources in ", dir, " but it does not exist")
}
dir
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.