Skip to content

Commit

Permalink
Modify all vignettes and examples to assume that neither github nor C…
Browse files Browse the repository at this point in the history
…RAN are available. #63
  • Loading branch information
andrie committed Mar 27, 2015
1 parent 7e9e6b2 commit dfe8080
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 396 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Description: Makes it possible to create an internally consistent
subset. The user can then install packages from this repository directly,
rather than from CRAN. This is useful in production settings, e.g. server
behind a firewall, or remote locations with slow broadband access.
Version: 0.2.2
Version: 0.2.4
URL: https://github.com/RevolutionAnalytics/miniCRAN
BugReports: https://github.com/RevolutionAnalytics/miniCRAN/issues
Date: 2015-03-26
Expand Down
8 changes: 4 additions & 4 deletions inst/doc/miniCRAN-dependency-graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ library("miniCRAN")

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

## ----makeDepGraph, warning=FALSE-----------------------------------------
dg <- makeDepGraph(tags, enhances=TRUE)
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)
pkgDep(tags, suggests = TRUE, enhances=FALSE, availPkgs = cranJuly2014)

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

41 changes: 20 additions & 21 deletions inst/doc/miniCRAN-dependency-graph.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions inst/doc/miniCRAN-dependency-graph.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ library("miniCRAN")

```{r pkgdep}
tags <- "chron"
pkgDep(tags)
pkgDep(tags, availPkgs = cranJuly2014)
```


To create an igraph plot of the dependencies, use the function `makeDepGraph()` and plot the results:

```{r makeDepGraph, warning=FALSE}
dg <- makeDepGraph(tags, enhances=TRUE)
dg <- makeDepGraph(tags, enhances=TRUE, availPkgs = cranJuly2014)
set.seed(1)
plot(dg, legendPosition = c(-1, 1), vertex.size=20)
```
Expand All @@ -72,9 +72,9 @@ As a final example, create a dependency graph of seven very popular R packages:

```{r 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)
pkgDep(tags, suggests = TRUE, enhances=FALSE, availPkgs = cranJuly2014)
dg <- makeDepGraph(tags, enhances=TRUE)
dg <- makeDepGraph(tags, enhances=TRUE, availPkgs = cranJuly2014)
set.seed(1)
plot(dg, legendPosition = c(-1, -1), vertex.size=10, cex=0.7)
```
Expand Down
116 changes: 58 additions & 58 deletions inst/doc/miniCRAN-introduction.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,72 @@ revolution <- c(CRAN="http://cran.revolutionanalytics.com")

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

## ----make-repo-2---------------------------------------------------------
# Create temporary folder for miniCRAN
dir.create(pth <- file.path(tempdir(), "miniCRAN"))
## ----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="source")
# makeRepo(pkgList, path=pth, repos=revolution, type="win.binary")

# Make repo for source and win.binary
makeRepo(pkgList, path=pth, repos=revolution, type="source")
makeRepo(pkgList, path=pth, repos=revolution, type="win.binary")
## ----make-repo-3, eval=FALSE---------------------------------------------
# # List all files in miniCRAN
# list.files(pth, recursive=TRUE, full.names=FALSE)

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

## ----make-repo-4---------------------------------------------------------
# Check for available packages
pkgAvail(repos=pth, type="win.binary")[, c(1:3, 5)]
## ----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----------------------------------------------------
# Add new packages (from CRAN) to the miniCRAN repo
addPackage("Matrix", path=pth, repos=revolution, type="source")

## ----addto-repo-old-1----------------------------------------------------
# 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----------------------------------------------------
# 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----------------------------------------------------
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-------------------------------------------------------
# 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-------------------------------------------------------
# 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----------------------------------------------
# Delete temporary folder
unlink(pth, recursive = TRUE)
## ----addto-repo-new-1, eval=FALSE----------------------------------------
# # Add new packages (from CRAN) to the miniCRAN repo
# addPackage("Matrix", path=pth, repos=revolution, type="source")

## ----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)

Loading

0 comments on commit dfe8080

Please sign in to comment.