This vignette demonstrates how to use a set of R functions to programmatically retrieve the URL and code host package hosted on CRAN, Bioconductor and Github.
We will walk through each step, from checking if a package exists on CRAN to fetching its version history and constructing an appropriate download URL.
fetch information from “https://cran.r-project.org/src/contrib/Archive/here/”
Create table with package_name,
package_version, link, date,
size from CRAN website
risk.assessr can also provide similar information from
Internal mirror
Steps to get an R package stored on Bioconductor
R packages stored on Github are assess by looking at BugReports or URL in DESCRIPTION file to find a owner. github link are then created such as below and used to request Github API.
urls <- c(
"https://github.com/tidyverse/ggplot2"
)
bug_reports <- c(
"https://github.com/tidyverse/ggplot2/issues"
)
all_links <- c(urls, bug_reports)
github_pattern <- "https://github.com/([^/]+)/([^/]+).*"
matching_links <- grep(github_pattern, all_links, value = TRUE)
owner_names <- sub(github_pattern, "\\1", matching_links)
package_names_github <- sub(github_pattern, "\\2", matching_links)
valid <- which(owner_names != "" & package_names_github != "")
if (length(valid) > 0) {
github_links <- unique(paste0("https://github.com/", owner_names[valid], "/", package_names_github[valid]))
} else {
github_links <- NULL
}
github_links