diff --git a/DESCRIPTION b/DESCRIPTION index b045f67..a0db7d9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 diff --git a/inst/doc/miniCRAN-dependency-graph.R b/inst/doc/miniCRAN-dependency-graph.R index d8ef3e0..1c53867 100644 --- a/inst/doc/miniCRAN-dependency-graph.R +++ b/inst/doc/miniCRAN-dependency-graph.R @@ -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) diff --git a/inst/doc/miniCRAN-dependency-graph.html b/inst/doc/miniCRAN-dependency-graph.html index a2ed658..44025c8 100644 --- a/inst/doc/miniCRAN-dependency-graph.html +++ b/inst/doc/miniCRAN-dependency-graph.html @@ -233,7 +233,7 @@

A worked example using the package chron

tags <- "chron"
-pkgDep(tags)
+pkgDep(tags, availPkgs = cranJuly2014)
 
##  [1] "chron"        "RColorBrewer" "dichromat"    "munsell"     
@@ -244,7 +244,7 @@ 

A worked example using the package chron

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

-
dg <- makeDepGraph(tags, enhances=TRUE)
+
dg <- makeDepGraph(tags, enhances=TRUE, availPkgs = cranJuly2014)
 
## Loading required namespace: igraph
@@ -254,7 +254,7 @@ 

A worked example using the package chron

plot(dg, legendPosition = c(-1, 1), vertex.size=20)
-

plot of chunk makeDepGraph

+

plot of chunk makeDepGraph

Note how the dependencies expand to zoo (enhanced), scales and ggplot (suggested) and then recursively from there to get all the Imports and LinkingTo dependencies.

@@ -263,7 +263,7 @@

An example with multiple input packages

As a final example, create a dependency graph of seven very popular R packages:

tags <- c("ggplot2", "data.table", "plyr", "knitr", "shiny", "xts", "lattice")
-pkgDep(tags, suggests = TRUE, enhances=FALSE)
+pkgDep(tags, suggests = TRUE, enhances=FALSE, availPkgs = cranJuly2014)
 
##  [1] "ggplot2"      "data.table"   "plyr"         "knitr"       
@@ -271,30 +271,29 @@ 

An example with multiple input packages

## [9] "gtable" "reshape2" "scales" "proto" ## [13] "MASS" "Rcpp" "stringr" "RColorBrewer" ## [17] "dichromat" "munsell" "labeling" "colorspace" -## [21] "chron" "evaluate" "formatR" "highr" -## [25] "markdown" "mime" "httpuv" "RJSONIO" -## [29] "xtable" "htmltools" "R6" "zoo" +## [21] "evaluate" "formatR" "highr" "markdown" +## [25] "mime" "httpuv" "caTools" "RJSONIO" +## [29] "xtable" "htmltools" "bitops" "zoo" ## [33] "SparseM" "survival" "Formula" "latticeExtra" -## [37] "cluster" "rpart" "nnet" "acepack" -## [41] "foreign" "maps" "sp" "mvtnorm" -## [45] "TH.data" "sandwich" "codetools" "nlme" -## [49] "Matrix" "bit" "iterators" "foreach" -## [53] "yaml" "caTools" "bitops" "timeDate" -## [57] "quadprog" "Hmisc" "BH" "quantreg" -## [61] "mapproj" "hexbin" "maptools" "multcomp" -## [65] "testthat" "mgcv" "reshape" "fastmatch" -## [69] "bit64" "abind" "doMC" "itertools" -## [73] "testit" "rgl" "rmarkdown" "XML" -## [77] "RCurl" "Cairo" "timeSeries" "tseries" -## [81] "its" "fts" "tis" "KernSmooth" +## [37] "cluster" "maps" "sp" "foreign" +## [41] "mvtnorm" "TH.data" "sandwich" "nlme" +## [45] "Matrix" "bit" "codetools" "iterators" +## [49] "timeDate" "quadprog" "Hmisc" "BH" +## [53] "quantreg" "mapproj" "hexbin" "maptools" +## [57] "multcomp" "testthat" "mgcv" "chron" +## [61] "reshape" "fastmatch" "bit64" "abind" +## [65] "foreach" "doMC" "itertools" "testit" +## [69] "rgl" "XML" "RCurl" "Cairo" +## [73] "timeSeries" "tseries" "its" "fts" +## [77] "tis" "KernSmooth"
-
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)
 
-

plot of chunk so-tags

+

plot of chunk so-tags

diff --git a/inst/doc/miniCRAN-dependency-graph.rmd b/inst/doc/miniCRAN-dependency-graph.rmd index e462d11..2d42cd6 100644 --- a/inst/doc/miniCRAN-dependency-graph.rmd +++ b/inst/doc/miniCRAN-dependency-graph.rmd @@ -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) ``` @@ -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) ``` diff --git a/inst/doc/miniCRAN-introduction.R b/inst/doc/miniCRAN-introduction.R index 41d3779..8245f07 100644 --- a/inst/doc/miniCRAN-introduction.R +++ b/inst/doc/miniCRAN-introduction.R @@ -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) diff --git a/inst/doc/miniCRAN-introduction.html b/inst/doc/miniCRAN-introduction.html index 3bf2be4..706cd8d 100644 --- a/inst/doc/miniCRAN-introduction.html +++ b/inst/doc/miniCRAN-introduction.html @@ -216,7 +216,7 @@

Creating a miniCRAN repository

# 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
@@ -227,39 +227,10 @@

Creating a miniCRAN repository

# Create temporary folder for miniCRAN
 dir.create(pth <- file.path(tempdir(), "miniCRAN"))
-
- -
## Warning in dir.create(pth <- file.path(tempdir(), "miniCRAN")):
-## 'C:\Users\ANDRIE~1\AppData\Local\Temp\Rtmpm2fNyk\miniCRAN' already exists
-
-
# Make repo for source and win.binary
+# Make repo for source and win.binary
 makeRepo(pkgList, path=pth, repos=revolution, type="source")
-
- -
## Created new folder: C:/Users/ANDRIE~1/AppData/Local/Temp/Rtmpm2fNyk/miniCRAN/src/contrib
-
- -
## Warning in download.file(url, destfile, method, mode = "wb", ...):
-## downloaded length 359739 != reported length 359739
-
- -
## [[1]]
-## [1] 3
-
- -
makeRepo(pkgList, path=pth, repos=revolution, type="win.binary")
-
- -
## Created new folder: C:/Users/ANDRIE~1/AppData/Local/Temp/Rtmpm2fNyk/miniCRAN/bin/windows/contrib/3.1
-
- -
## Warning in download.file(url, destfile, method, mode = "wb", ...):
-## downloaded length 388705 != reported length 388705
-
- -
## [[1]]
-## [1] 3
+makeRepo(pkgList, path=pth, repos=revolution, type="win.binary")
 

Investigate the repository file structure:

@@ -268,46 +239,12 @@

Creating a miniCRAN repository

list.files(pth, recursive=TRUE, full.names=FALSE)
-
##  [1] "2015-03-27/bin/macosx/contrib/3.1/adaptivetau_2.2.tgz" 
-##  [2] "2015-03-27/bin/macosx/contrib/3.1/aprof_0.2.4.tgz"     
-##  [3] "2015-03-27/bin/macosx/contrib/3.1/chron_2.3-45.tgz"    
-##  [4] "2015-03-27/bin/macosx/contrib/3.1/PACKAGES"            
-##  [5] "2015-03-27/bin/macosx/contrib/3.1/PACKAGES.gz"         
-##  [6] "2015-03-27/bin/windows/contrib/3.1/adaptivetau_2.2.zip"
-##  [7] "2015-03-27/bin/windows/contrib/3.1/aprof_0.2.4.zip"    
-##  [8] "2015-03-27/bin/windows/contrib/3.1/chron_2.3-45.zip"   
-##  [9] "2015-03-27/bin/windows/contrib/3.1/PACKAGES"           
-## [10] "2015-03-27/bin/windows/contrib/3.1/PACKAGES.gz"        
-## [11] "2015-03-27/src/contrib/adaptivetau_2.2.tar.gz"         
-## [12] "2015-03-27/src/contrib/aprof_0.2.1.tar.gz"             
-## [13] "2015-03-27/src/contrib/aprof_0.2.4.tar.gz"             
-## [14] "2015-03-27/src/contrib/chron_2.3-45.tar.gz"            
-## [15] "2015-03-27/src/contrib/PACKAGES"                       
-## [16] "2015-03-27/src/contrib/PACKAGES.gz"                    
-## [17] "bin/windows/contrib/3.1/codetools_0.2-11.zip"          
-## [18] "bin/windows/contrib/3.1/foreach_1.4.2.zip"             
-## [19] "bin/windows/contrib/3.1/iterators_1.0.7.zip"           
-## [20] "bin/windows/contrib/3.1/PACKAGES"                      
-## [21] "bin/windows/contrib/3.1/PACKAGES.gz"                   
-## [22] "src/contrib/codetools_0.2-11.tar.gz"                   
-## [23] "src/contrib/foreach_1.4.2.tar.gz"                      
-## [24] "src/contrib/iterators_1.0.7.tar.gz"                    
-## [25] "src/contrib/PACKAGES"                                  
-## [26] "src/contrib/PACKAGES.gz"
-
-

Use pkgAvail to list available packages in your repository:

# Check for available packages
 pkgAvail(repos=pth, type="win.binary")[, c(1:3, 5)]
 
-
##           Package     Version  Priority      Imports                      
-## codetools "codetools" "0.2-11" "recommended" NA                           
-## foreach   "foreach"   "1.4.2"  NA            "codetools, utils, iterators"
-## iterators "iterators" "1.0.7"  NA            NA
-
-

Install packages from your local repository

To install packages from a local repository, you need to use the URI convention file:/// to point to your file lcoation.

@@ -344,86 +281,28 @@

Adding an older version of a package from CRAN

addOldPackage(pkgList, path=pth, vers=oldVers$version, repos=revolution, type="source")
-
## Warning in download.file(x, destfile = file.path(pkgPath, basename(x)), :
-## downloaded length 359222 != reported length 359222
-
-

You will get a warning whenever there are multiple versions of a package saved in the repository. Currently, you need to manually remove duplicate versions before rebuilding the repository's package index.

Note: This last step is important, otherwise you may end up with a repo in an inconsistent state.

# List package versions in the miniCRAN repo (produces warning about duplicates)
 pkgVersionsSrc <- checkVersions(pkgList, path=pth, type="source")
-
- -
## Warning in checkVersions(pkgList, path = pth, type = "source"): Duplicate
-## package(s): foreach, codetools, iterators
-
- -
pkgVersionsBin <- checkVersions(pkgList, path=pth, type="win.binary")
+pkgVersionsBin <- checkVersions(pkgList, path=pth, type="win.binary")
 
 # After inspecting package versions, remove old versions
 basename(pkgVersionsSrc) # duplicate versions
-
- -
## [1] "foreach_1.4.0.tar.gz"    "foreach_1.4.2.tar.gz"   
-## [3] "codetools_0.2-11.tar.gz" "codetools_0.2-7.tar.gz" 
-## [5] "iterators_1.0.5.tar.gz"  "iterators_1.0.7.tar.gz"
-
+basename(pkgVersionsBin) -
basename(pkgVersionsBin)
-
- -
## [1] "foreach_1.4.2.zip"    "codetools_0.2-11.zip" "iterators_1.0.7.zip"
-
+file.remove(pkgVersionsSrc[c(2,4,6)]) -
file.remove(pkgVersionsSrc[c(2,4,6)])
-
- -
## [1] TRUE TRUE TRUE
-
- -
# rebuild the package index after removing duplicate package versions
+# rebuild the package index after removing duplicate package versions
 updateRepoIndex(pth, type=c("source", "win.binary"))
 
-
## [[1]]
-## [1] 7
-## 
-## [[2]]
-## [1] 3
-
-

To see the updated list of packages available in the miniCRAN repo:

pkgAvail(pth, type="source")[, c(1:3, 5)] # contains the old versions
-
- -
##           Package     Version    Priority     
-## codetools "codetools" "0.2-11"   "recommended"
-## expm      "expm"      "0.99-1.1" NA           
-## foreach   "foreach"   "1.4.0"    NA           
-## iterators "iterators" "1.0.5"    NA           
-## lattice   "lattice"   "0.20-30"  "recommended"
-## MASS      "MASS"      "7.3-40"   "recommended"
-## Matrix    "Matrix"    "1.1-5"    "recommended"
-##           Imports                                  
-## codetools NA                                       
-## expm      NA                                       
-## foreach   "codetools, utils, iterators"            
-## iterators NA                                       
-## lattice   "grid, grDevices, graphics, stats, utils"
-## MASS      NA                                       
-## Matrix    "graphics, grid, stats, utils, lattice"
-
- -
pkgAvail(pth, type="win.binary")[, c(1:3, 5)] # contains the current versions
-
- -
##           Package     Version  Priority      Imports                      
-## codetools "codetools" "0.2-11" "recommended" NA                           
-## foreach   "foreach"   "1.4.2"  NA            "codetools, utils, iterators"
-## iterators "iterators" "1.0.7"  NA            NA
+pkgAvail(pth, type="win.binary")[, c(1:3, 5)] # contains the current versions
 

Adding packages from other sources

@@ -436,17 +315,7 @@

Updating the packages in a miniCRAN repository

# Check if updated packages are available
 oldPackages(path=pth, repos=revolution, type="source")[, 1:3] # should need update
-
- -
##           Package     LocalVer ReposVer
-## foreach   "foreach"   "1.4.0"  "1.4.2" 
-## iterators "iterators" "1.0.5"  "1.0.7"
-
- -
oldPackages(path=pth, repos=revolution, type="win.binary")[, 1:3] # should be current
-
- -
##      Package LocalVer ReposVer
+oldPackages(path=pth, repos=revolution, type="win.binary")[, 1:3] # should be current
 

Update the versions of the packages currently stored in the miniCRAN repository. By default, a prompt is given to confirm the update for each package. This prompt can be suppressed using ask=FALSE, which will update all packages. Be careful using this option if you want to keep certain packages at an older version.

diff --git a/inst/doc/miniCRAN-introduction.rmd b/inst/doc/miniCRAN-introduction.rmd index 78b9e65..e41f8b7 100644 --- a/inst/doc/miniCRAN-introduction.rmd +++ b/inst/doc/miniCRAN-introduction.rmd @@ -30,13 +30,13 @@ 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 ``` Next, create a repository with the function `makeRepo()`. In this example, get the required files for `source` packages as well as windows binaries: -```{r make-repo-2} +```{r make-repo-2, eval=FALSE} # Create temporary folder for miniCRAN dir.create(pth <- file.path(tempdir(), "miniCRAN")) @@ -48,7 +48,7 @@ makeRepo(pkgList, path=pth, repos=revolution, type="win.binary") Investigate the repository file structure: -```{r make-repo-3} +```{r make-repo-3, eval=FALSE} # List all files in miniCRAN list.files(pth, recursive=TRUE, full.names=FALSE) ``` @@ -56,7 +56,7 @@ list.files(pth, recursive=TRUE, full.names=FALSE) Use `pkgAvail` to list available packages in your repository: -```{r make-repo-4} +```{r make-repo-4, eval=FALSE} # Check for available packages pkgAvail(repos=pth, type="win.binary")[, c(1:3, 5)] ``` @@ -78,7 +78,7 @@ install.packages(pkgs, After creating a local miniCRAN repository, additional packages and their dependencies can easily be added. This mechanism can also be used to re-add an existing package to the miniCRAN repo. -```{r addto-repo-new-1} +```{r addto-repo-new-1, eval=FALSE} # Add new packages (from CRAN) to the miniCRAN repo addPackage("Matrix", path=pth, repos=revolution, type="source") ``` @@ -91,7 +91,7 @@ To add a specific version of a package from CRAN (or another CRAN-like repositor *Note:* in order to to add binaries of older packages, you will need to download the source and build the binaries on the intended platform yourself. You will need the appropriate R development tools installed in order to build package binaries from source. -```{r addto-repo-old-1} +```{r 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"), @@ -105,7 +105,7 @@ You will get a warning whenever there are multiple versions of a package saved i Note: This last step is important, otherwise you may end up with a repo in an inconsistent state. -```{r addto-repo-old-2} +```{r 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") @@ -122,7 +122,7 @@ updateRepoIndex(pth, type=c("source", "win.binary")) To see the updated list of packages available in the miniCRAN repo: -```{r addto-repo-old-3} +```{r 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 ``` @@ -138,7 +138,7 @@ This feature will be implemented in a future release. Checking for updated versions of the packages currently stored in the miniCRAN repository: -```{r update-repo-1} +```{r 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 @@ -147,7 +147,7 @@ oldPackages(path=pth, repos=revolution, type="win.binary")[, 1:3] # should be cu Update the versions of the packages currently stored in the miniCRAN repository. By default, a prompt is given to confirm the update for each package. This prompt can be suppressed using `ask=FALSE`, which will update all packages. Be careful using this option if you want to keep certain packages at an older version. -```{r update-repo-2} +```{r 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 @@ -156,7 +156,7 @@ updatePackages(path=pth, repos=revolution, type="win.binary", ask=FALSE) # shoul -```{r cleanup, include=FALSE} +```{r cleanup, include=FALSE, eval=FALSE} # Delete temporary folder unlink(pth, recursive = TRUE) ``` diff --git a/inst/doc/miniCRAN-non-CRAN-repos.R b/inst/doc/miniCRAN-non-CRAN-repos.R index f8f0834..d1df790 100644 --- a/inst/doc/miniCRAN-non-CRAN-repos.R +++ b/inst/doc/miniCRAN-non-CRAN-repos.R @@ -12,33 +12,28 @@ index <- function(url, type="source", filters=NULL, head=5, cols=c("Package", "V # CRAN <- "http://cran.r-project.org" # index(CRAN) -## ----CRAN-mock, echo=FALSE----------------------------------------------- -# One has to assume CRAN master is not available, hence mock the behaviour using a different mirror -CRAN <- "http://cran.revolutionanalytics.com" -index(CRAN) +## ----revo, eval=FALSE---------------------------------------------------- +# revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable" +# index(revoStable) +# +# revoMirror <- "http://cran.revolutionanalytics.com" +# index(revoMirror) -## ----revo---------------------------------------------------------------- -revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable" -index(revoStable) - -revoMirror <- "http://cran.revolutionanalytics.com" -index(revoMirror) - -## ----rforge-------------------------------------------------------------- -rforge <- "http://r-forge.r-project.org" -index(rforge) +## ----rforge, eval=FALSE-------------------------------------------------- +# rforge <- "http://r-forge.r-project.org" +# index(rforge) -## ----bioc---------------------------------------------------------------- -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"]) +## ----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"]) diff --git a/inst/doc/miniCRAN-non-CRAN-repos.html b/inst/doc/miniCRAN-non-CRAN-repos.html index 9ad2689..32b1089 100644 --- a/inst/doc/miniCRAN-non-CRAN-repos.html +++ b/inst/doc/miniCRAN-non-CRAN-repos.html @@ -226,42 +226,17 @@

Using CRAN

index(CRAN) -
##             Package       Version
-## A3          "A3"          "0.9.2"
-## abc         "abc"         "2.0"  
-## ABCanalysis "ABCanalysis" "1.0"  
-## abcdeFBA    "abcdeFBA"    "0.4"  
-## ABCExtremes "ABCExtremes" "1.0"
-
-

Using a different mirror

You can also point to any other mirror, for example the stable version hosted by Revolution Analytics:

revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable"
 index(revoStable)
-
- -
##             Package       Version  
-## A3          "A3"          "0.9.2"  
-## abc         "abc"         "2.0"    
-## abcdeFBA    "abcdeFBA"    "0.4"    
-## ABCExtremes "ABCExtremes" "1.0"    
-## ABCoptim    "ABCoptim"    "0.13.11"
-
-
revoMirror <- "http://cran.revolutionanalytics.com"
+revoMirror <- "http://cran.revolutionanalytics.com"
 index(revoMirror)
 
-
##             Package       Version
-## A3          "A3"          "0.9.2"
-## abc         "abc"         "2.0"  
-## ABCanalysis "ABCanalysis" "1.0"  
-## abcdeFBA    "abcdeFBA"    "0.4"  
-## ABCExtremes "ABCExtremes" "1.0"
-
-

Using R-forge

R-forge has CRAN-like structure:

@@ -270,14 +245,6 @@

Using R-forge

index(rforge) -
##             Package       Version 
-## a4Core      "a4Core"      "0.99.0"
-## a4Reporting "a4Reporting" "0.0-3" 
-## abd         "abd"         "0.1-23"
-## abind       "abind"       "1.4-3" 
-## abmi        "abmi"        "0.1-0"
-
-

Using BioConductor

Although BioConductor has a different preferred install mechanism, the underlying repository structure is also CRAN-like:

@@ -288,50 +255,12 @@

Using BioConductor

evalq(source("http://bioconductor.org/biocLite.R", local=TRUE), env) biocinstallRepos() }) - -
## Bioconductor version 3.0 (BiocInstaller 1.16.1), ?biocLite for help
-
- -
bioc
-
- -
##                                               BioCsoft 
-##            "http://bioconductor.org/packages/3.0/bioc" 
-##                                                BioCann 
-## "http://bioconductor.org/packages/3.0/data/annotation" 
-##                                                BioCexp 
-## "http://bioconductor.org/packages/3.0/data/experiment" 
-##                                              BioCextra 
-##           "http://bioconductor.org/packages/3.0/extra" 
-##                                                   CRAN 
-##                  "http://cran.revolutionanalytics.com" 
-##                                              CRANextra 
-##                   "http://www.stats.ox.ac.uk/pub/RWin"
-
+bioc +bioc[grep("BioC", names(bioc))] -
bioc[grep("BioC", names(bioc))]
-
- -
##                                               BioCsoft 
-##            "http://bioconductor.org/packages/3.0/bioc" 
-##                                                BioCann 
-## "http://bioconductor.org/packages/3.0/data/annotation" 
-##                                                BioCexp 
-## "http://bioconductor.org/packages/3.0/data/experiment" 
-##                                              BioCextra 
-##           "http://bioconductor.org/packages/3.0/extra"
-
- -
index(bioc["BioCsoft"])
-
-
##           Package     Version 
-## a4        "a4"        "1.14.0"
-## a4Base    "a4Base"    "1.14.0"
-## a4Classif "a4Classif" "1.14.0"
-## a4Core    "a4Core"    "1.14.0"
-## a4Preproc "a4Preproc" "1.14.0"
+index(bioc["BioCsoft"])
 
diff --git a/inst/doc/miniCRAN-non-CRAN-repos.rmd b/inst/doc/miniCRAN-non-CRAN-repos.rmd index 700a38c..7837e6f 100644 --- a/inst/doc/miniCRAN-non-CRAN-repos.rmd +++ b/inst/doc/miniCRAN-non-CRAN-repos.rmd @@ -43,18 +43,12 @@ CRAN <- "http://cran.r-project.org" index(CRAN) ``` -```{r CRAN-mock, echo=FALSE} -# One has to assume CRAN master is not available, hence mock the behaviour using a different mirror -CRAN <- "http://cran.revolutionanalytics.com" -index(CRAN) -``` - ## Using a different mirror You can also point to any other mirror, for example the stable version hosted by Revolution Analytics: -```{r revo} +```{r revo, eval=FALSE} revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable" index(revoStable) @@ -66,7 +60,7 @@ index(revoMirror) R-forge has CRAN-like structure: -```{r rforge} +```{r rforge, eval=FALSE} rforge <- "http://r-forge.r-project.org" index(rforge) ``` @@ -75,7 +69,7 @@ index(rforge) Although BioConductor has a different preferred install mechanism, the underlying repository structure is also CRAN-like: -```{r bioc} +```{r bioc, eval=FALSE} bioc <- local({ env <- new.env() on.exit(rm(env)) diff --git a/inst/examples/example_addPackageListingGithub.R b/inst/examples/example_addPackageListingGithub.R index 5fee445..f201d9c 100644 --- a/inst/examples/example_addPackageListingGithub.R +++ b/inst/examples/example_addPackageListingGithub.R @@ -3,17 +3,17 @@ pdb <- cranJuly2014 \dontrun{ pdb <- pkgAvail(repos=c(CRAN="http://cran.revolutionanalytics.com")) -} - -# Overwrite pdb with development version of miniCRAN at github -\dontrun{ + + + # Overwrite pdb with development version of miniCRAN at github newpdb <- addPackageListingGithub(pdb=pdb, "andrie/miniCRAN") newpdb["miniCRAN", ] + + + # Add package from github that's not currently on CRAN + newpdb <- addPackageListingGithub(pdb=pdb, repo="RevolutionAnalytics/checkpoint") + newpdb["checkpoint", ] + + set.seed(1) + plot(makeDepGraph("checkpoint", availPkgs = newpdb, suggests=TRUE)) } - -# Add package from github that's not currently on CRAN -newpdb <- addPackageListingGithub(pdb=pdb, repo="RevolutionAnalytics/checkpoint") -newpdb["checkpoint", ] - -set.seed(1) -plot(makeDepGraph("checkpoint", availPkgs = newpdb, suggests=TRUE)) diff --git a/man/addPackageListingGithub.Rd b/man/addPackageListingGithub.Rd index 3c19694..5379ab3 100644 --- a/man/addPackageListingGithub.Rd +++ b/man/addPackageListingGithub.Rd @@ -25,19 +25,19 @@ pdb <- cranJuly2014 \dontrun{ pdb <- pkgAvail(repos=c(CRAN="http://cran.revolutionanalytics.com")) -} - -# Overwrite pdb with development version of miniCRAN at github -\dontrun{ + + + # Overwrite pdb with development version of miniCRAN at github newpdb <- addPackageListingGithub(pdb=pdb, "andrie/miniCRAN") newpdb["miniCRAN", ] + + + # Add package from github that's not currently on CRAN + newpdb <- addPackageListingGithub(pdb=pdb, repo="RevolutionAnalytics/checkpoint") + newpdb["checkpoint", ] + + set.seed(1) + plot(makeDepGraph("checkpoint", availPkgs = newpdb, suggests=TRUE)) } - -# Add package from github that's not currently on CRAN -newpdb <- addPackageListingGithub(pdb=pdb, repo="RevolutionAnalytics/checkpoint") -newpdb["checkpoint", ] - -set.seed(1) -plot(makeDepGraph("checkpoint", availPkgs = newpdb, suggests=TRUE)) } diff --git a/vignettes/miniCRAN-dependency-graph.rmd b/vignettes/miniCRAN-dependency-graph.rmd index e462d11..2d42cd6 100644 --- a/vignettes/miniCRAN-dependency-graph.rmd +++ b/vignettes/miniCRAN-dependency-graph.rmd @@ -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) ``` @@ -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) ``` diff --git a/vignettes/miniCRAN-introduction.rmd b/vignettes/miniCRAN-introduction.rmd index 78b9e65..e41f8b7 100644 --- a/vignettes/miniCRAN-introduction.rmd +++ b/vignettes/miniCRAN-introduction.rmd @@ -30,13 +30,13 @@ 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 ``` Next, create a repository with the function `makeRepo()`. In this example, get the required files for `source` packages as well as windows binaries: -```{r make-repo-2} +```{r make-repo-2, eval=FALSE} # Create temporary folder for miniCRAN dir.create(pth <- file.path(tempdir(), "miniCRAN")) @@ -48,7 +48,7 @@ makeRepo(pkgList, path=pth, repos=revolution, type="win.binary") Investigate the repository file structure: -```{r make-repo-3} +```{r make-repo-3, eval=FALSE} # List all files in miniCRAN list.files(pth, recursive=TRUE, full.names=FALSE) ``` @@ -56,7 +56,7 @@ list.files(pth, recursive=TRUE, full.names=FALSE) Use `pkgAvail` to list available packages in your repository: -```{r make-repo-4} +```{r make-repo-4, eval=FALSE} # Check for available packages pkgAvail(repos=pth, type="win.binary")[, c(1:3, 5)] ``` @@ -78,7 +78,7 @@ install.packages(pkgs, After creating a local miniCRAN repository, additional packages and their dependencies can easily be added. This mechanism can also be used to re-add an existing package to the miniCRAN repo. -```{r addto-repo-new-1} +```{r addto-repo-new-1, eval=FALSE} # Add new packages (from CRAN) to the miniCRAN repo addPackage("Matrix", path=pth, repos=revolution, type="source") ``` @@ -91,7 +91,7 @@ To add a specific version of a package from CRAN (or another CRAN-like repositor *Note:* in order to to add binaries of older packages, you will need to download the source and build the binaries on the intended platform yourself. You will need the appropriate R development tools installed in order to build package binaries from source. -```{r addto-repo-old-1} +```{r 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"), @@ -105,7 +105,7 @@ You will get a warning whenever there are multiple versions of a package saved i Note: This last step is important, otherwise you may end up with a repo in an inconsistent state. -```{r addto-repo-old-2} +```{r 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") @@ -122,7 +122,7 @@ updateRepoIndex(pth, type=c("source", "win.binary")) To see the updated list of packages available in the miniCRAN repo: -```{r addto-repo-old-3} +```{r 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 ``` @@ -138,7 +138,7 @@ This feature will be implemented in a future release. Checking for updated versions of the packages currently stored in the miniCRAN repository: -```{r update-repo-1} +```{r 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 @@ -147,7 +147,7 @@ oldPackages(path=pth, repos=revolution, type="win.binary")[, 1:3] # should be cu Update the versions of the packages currently stored in the miniCRAN repository. By default, a prompt is given to confirm the update for each package. This prompt can be suppressed using `ask=FALSE`, which will update all packages. Be careful using this option if you want to keep certain packages at an older version. -```{r update-repo-2} +```{r 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 @@ -156,7 +156,7 @@ updatePackages(path=pth, repos=revolution, type="win.binary", ask=FALSE) # shoul -```{r cleanup, include=FALSE} +```{r cleanup, include=FALSE, eval=FALSE} # Delete temporary folder unlink(pth, recursive = TRUE) ``` diff --git a/vignettes/miniCRAN-non-CRAN-repos.rmd b/vignettes/miniCRAN-non-CRAN-repos.rmd index 700a38c..7837e6f 100644 --- a/vignettes/miniCRAN-non-CRAN-repos.rmd +++ b/vignettes/miniCRAN-non-CRAN-repos.rmd @@ -43,18 +43,12 @@ CRAN <- "http://cran.r-project.org" index(CRAN) ``` -```{r CRAN-mock, echo=FALSE} -# One has to assume CRAN master is not available, hence mock the behaviour using a different mirror -CRAN <- "http://cran.revolutionanalytics.com" -index(CRAN) -``` - ## Using a different mirror You can also point to any other mirror, for example the stable version hosted by Revolution Analytics: -```{r revo} +```{r revo, eval=FALSE} revoStable <- "http://packages.revolutionanalytics.com/cran/3.1/stable" index(revoStable) @@ -66,7 +60,7 @@ index(revoMirror) R-forge has CRAN-like structure: -```{r rforge} +```{r rforge, eval=FALSE} rforge <- "http://r-forge.r-project.org" index(rforge) ``` @@ -75,7 +69,7 @@ index(rforge) Although BioConductor has a different preferred install mechanism, the underlying repository structure is also CRAN-like: -```{r bioc} +```{r bioc, eval=FALSE} bioc <- local({ env <- new.env() on.exit(rm(env))