Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrie committed Jan 15, 2018
1 parent 03415b1 commit 2288a76
Show file tree
Hide file tree
Showing 18 changed files with 162 additions and 21 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Create a mini version of CRAN containing only selected packages

## Introduction

At the end of 2014, CRAN consisted of more than 6,000 packages. By then end of 2017, the number of packages doubled to more than 12,000. Many organisations need to maintain a private mirror of CRAN, but with only a subset of packages that are relevant to them.
At the end of 201, CRAN consisted of more than 6,000 packages, and by 2017 this number doubled to more than 12,000. Many organisations need to maintain a private mirror of CRAN, but with only a subset of packages that are relevant to them.

The `miniCRAN` package makes it possible to create an internally consistent repository consisting of selected packages from CRAN-like repositories. The user specifies a set of desired packages, and `miniCRAN` recursively reads the dependency tree for these packages, then downloads only this subset.

Expand Down Expand Up @@ -49,15 +49,15 @@ The `miniCRAN` package itself doesn't introduce any system dependencies. Howeve

* On systems with the `rpm` package manager (Red Hat, CentOS) try:

```sh
yum install libcurl-devel libxml2-devel openssl-devel
```
```
yum install libcurl-devel libxml2-devel openssl-devel
```

* On systems with the `aptitude` package manager (Debian, Ubuntu) try:

```sh
apt-get install libcurl4-openssl-dev libxml2-devel openssl-devel
```
```
apt-get install libcurl4-openssl-dev libxml2-devel openssl-devel
```


## Example:
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions docs/articles/miniCRAN-dependency-graph.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## ----init----------------------------------------------------------------
library("miniCRAN")

## ----pkgdep--------------------------------------------------------------
tags <- "chron"
pkgDep(tags, availPkgs = cranJuly2014)

## ----makeDepGraph, warning=FALSE-----------------------------------------
dg <- makeDepGraph(tags, enhances = TRUE, availPkgs = cranJuly2014)
set.seed(1)
plot(dg, legendPosition = c(-1, 1), vertex.size = 20)

## ----so-tags, warning=FALSE, fig.width=10, fig.height=10-----------------
tags <- c("ggplot2", "data.table", "plyr", "knitr", "shiny", "xts", "lattice")
pkgDep(tags, suggests = TRUE, enhances = FALSE, availPkgs = cranJuly2014)

dg <- makeDepGraph(tags, enhances = TRUE, availPkgs = cranJuly2014)
set.seed(1)
plot(dg, legendPosition = c(-1, -1), vertex.size = 10, cex = 0.7)

2 changes: 1 addition & 1 deletion docs/articles/miniCRAN-dependency-graph.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions docs/articles/miniCRAN-introduction.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
## ----make-repo-1---------------------------------------------------------
library("miniCRAN")

# use Revolution Analytics CRAN mirror
revolution <- c(CRAN = "http://cran.microsoft.com")

# Specify list of packages to download
pkgs <- c("foreach")
pkgList <- pkgDep(pkgs, repos = revolution, type = "source", suggests = FALSE,
availPkgs = cranJuly2014)
pkgList

## ----make-repo-2, eval=FALSE---------------------------------------------
# # Create temporary folder for miniCRAN
# dir.create(pth <- file.path(tempdir(), "miniCRAN"))
#
# # Make repo for source and win.binary
# makeRepo(pkgList, path=pth, repos=revolution, type=c("source", "win.binary"))

## ----make-repo-3, eval=FALSE---------------------------------------------
# # List all files in miniCRAN
# list.files(pth, recursive = TRUE, full.names = FALSE)

## ----make-repo-4, eval=FALSE---------------------------------------------
# # Check for available packages
# pkgAvail(repos = pth, type = "win.binary")[, c(1:3, 5)]

## ----make-repo-5, eval=FALSE---------------------------------------------
# install.packages(pkgs,
# repos = paste0("file:///", pth),
# type = "source")

## ----addto-repo-new-1, eval=FALSE----------------------------------------
# # Add new packages (from CRAN) to the miniCRAN repo
# addPackage("Matrix", path = pth, repos = revolution, type = c("source", "win.binary"))
# pkgAvail(repos = pth, type = "win.binary")[, c(1:3, 5)]

## ----addto-repo-old-1, eval=FALSE----------------------------------------
# # create a data frame with the package and version info
# oldVers <- data.frame(
# package = c("foreach", "codetools", "iterators"),
# version = c("1.4.0", "0.2-7", "1.0.5"),
# stringsAsFactors = FALSE
# )
#
# # download old source package version and create repo index
# addOldPackage(pkgList, path = pth, vers = oldVers$version, repos = revolution, type = "source")

## ----addto-repo-old-2, eval=FALSE----------------------------------------
# # List package versions in the miniCRAN repo (produces warning about duplicates)
# pkgVersionsSrc <- checkVersions(pkgList, path = pth, type = "source")
# pkgVersionsBin <- checkVersions(pkgList, path = pth, type = "win.binary")
#
# # After inspecting package versions, remove old versions
# basename(pkgVersionsSrc) # duplicate versions
# basename(pkgVersionsBin)
#
# file.remove(pkgVersionsSrc[c(2,4,6)])
#
# # rebuild the package index after removing duplicate package versions
# updateRepoIndex(pth, type = c("source", "win.binary"))

## ----addto-repo-old-3, eval=FALSE----------------------------------------
# pkgAvail(pth, type = "source")[, c(1:3, 5)] # contains the old versions
# pkgAvail(pth, type = "win.binary")[, c(1:3, 5)] # contains the current versions

## ----update-repo-1, eval=FALSE-------------------------------------------
# # Check if updated packages are available
# oldPackages(path = pth, repos = revolution, type = "source")[, 1:3] # should need update
# oldPackages(path = pth, repos = revolution, type = "win.binary")[, 1:3] # should be current

## ----update-repo-2, eval=FALSE-------------------------------------------
# # Update available packages
# updatePackages(path = pth, repos = revolution, type = "source", ask = FALSE) # should need update
# updatePackages(path = pth, repos = revolution, type = "win.binary", ask = FALSE) # should be current

## ----cleanup, include=FALSE, eval=FALSE----------------------------------
# # Delete temporary folder
# unlink(pth, recursive = TRUE)

4 changes: 2 additions & 2 deletions docs/articles/miniCRAN-introduction.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions docs/articles/miniCRAN-non-CRAN-repos.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## ----setup---------------------------------------------------------------
# Wrapper around available.packages ---------------------------------------

index <- function(url, type = "source", filters = NULL, head = 5, cols = c("Package", "Version")) {
contribUrl <- contrib.url(url, type = type)
p <- available.packages(contribUrl, type = type, filters = filters)
p[1:head, cols]
}


## ----CRAN, eval=FALSE----------------------------------------------------
# CRAN <- "http://cran.r-project.org"
# index(CRAN)

## ----revo, eval=FALSE----------------------------------------------------
# revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable"
# index(revoStable)
#
# revoMirror <- "http://cran.revolutionanalytics.com"
# index(revoMirror)

## ----rforge, eval=FALSE--------------------------------------------------
# rforge <- "http://r-forge.r-project.org"
# index(rforge)

## ----bioc, eval=FALSE----------------------------------------------------
# bioc <- local({
# env <- new.env()
# on.exit(rm(env))
# evalq(source("http://bioconductor.org/biocLite.R", local = TRUE), env)
# biocinstallRepos()
# })
#
# bioc
# bioc[grep("BioC", names(bioc))]
#
#
# index(bioc["BioCsoft"])

4 changes: 2 additions & 2 deletions docs/articles/miniCRAN-non-CRAN-repos.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified docs/reference/makeDepGraph-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/plot.pkgDepGraph-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/plot.pkgDepGraph-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/plot.pkgDepGraph-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/plot.pkgDepGraph-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/reference/updatePackages.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2288a76

Please sign in to comment.