Skip to content

Instantly share code, notes, and snippets.

@andrie
Last active April 2, 2018 11:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrie/d68834d68f4724432929 to your computer and use it in GitHub Desktop.
Save andrie/d68834d68f4724432929 to your computer and use it in GitHub Desktop.
Introduction to miniCRAN
# Install package from CRAN
getOption("repos")
options(repos=c(CRAN="http://cran.at.r-project.org/"))
install.packages("miniCRAN", type="source")
library("miniCRAN")
sessionInfo()
library("miniCRAN")
sessionInfo()
pkgs <- c("chron")
pkgDep(pkgs)
p <- makeDepGraph(pkgs, enhances = TRUE)
?plot.pkgDepGraph
set.seed(20140917)
plot(p, cex=1.5, vertex.size=15)
library("miniCRAN")
options(repos = c(CRAN = "http://cran.at.r-project.org/"))
pkgs <- c("data.table", "dplyr", "ggvis", "tidyr", "ggplot2")
pkgDep(pkgs, enhances=TRUE)
p <- makeDepGraph(pkgs, enhances = TRUE)
set.seed(1)
plot(p, cex=1, vertex.size=15)
pth <- "C:/Users/Andrie/Downloads/miniCRAN"
makeRepo(pkgDep(pkgs), path=pth, download=TRUE)
library("miniCRAN")
options(repos = c(CRAN = "http://cran.at.r-project.org/"))
pkgs <- c("data.table", "dplyr")
localCRAN <- "~/local-CRAN-repo"
dir.create(localCRAN)
makeRepo(pkgDep(pkgs), path = localCRAN, type = "source")
makeRepo(pkgDep(pkgs), path = localCRAN, type = "win.binary")
list.files(path = localCRAN, recursive = TRUE)
uri <- paste0("file:///", normalizePath(localCRAN))
uri
options(repos = c(CRAN=uri))
getOption("repos")
available.packages(type="source")
available.packages()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment