By Andrie de Vries

How many packages exist on CRAN? Joseph Rickert went fishing for packages and said the answer is 6,789 (on June 18th, 2015).

But is that really the same answer for everybody?

Well, the simple answer is, it depends. Primarily, it depends on your operating system, but also your version of R. CRAN doesn't create binaries for all packages, most likely because of special dependency considerations.

With 20 lines of code you can explore some of the statistics:

```
types <- c("source", "win.binary",
"mac.binary", "mac.binary.mavericks")
CRANmirror <- "http://cran.revolutionanalytics.com"
pdb <- lapply(types, function(x){
cran <- contrib.url(repos = CRANmirror,
type = x)
available.packages(contriburl = cran, type = x)
})
names(pdb) <- types
str(pdb, max.level = 1)
```

# Number of available packages
sapply(pdb, nrow)
# Display first few packages for each type
lkgs <- sapply(pdb, rownames)
lapply(pkgs, head)
# Create list of differences between source and win.binary
setdiff(pkgs[["source"]], pkgs[["win.binary"]])

This code tells me several interesting things.

Firstly, the number of available packages, depending if you install from source or use the binary:

> sapply(pdb, nrow)

source win.binary mac.binary mac.binary.mavericks

6760 6712 4639 4820

So, although CRAN contains 6,760 source packages, only 6,712 have associated windows binaries.

This leave the question, which 48 packages are not available for windows? Given that we already have two lists for the packages of each type, we can answer this using the setdiff() function:

setdiff(pkgs[["source"]], pkgs[["win.binary"]])

[1] "bigalgebra" "CARramps"

[3] "CARrampsOcl" "Causata"

[5] "CopyNumber450kCancer" "cplexAPI"

[7] "cqrReg" "cudaBayesreg"

[9] "dbConnect" "doMPI"

[11] "eco" "gpclib"

[13] "gputools" "ifa"

[15] "iFes" "M3"

[17] "modQR" "nbconvertR"

[19] "ncdf4" "ncdf4.helpers"

[21] "ocean" "OpenCL"

[23] "ora" "PAGWAS"

[25] "pbdBASE" "pbdDEMO"

[27] "pbdDMAT" "permGPU"

[29] "pmclust" "qtbase"

[31] "qtpaint" "qtutils"

[33] "Rcplex" "RcppOctave"

[35] "RDieHarder" "REBayes"

[37] "rJavax" "Rmosek"

[39] "ROracle" "rpud"

[41] "RSAP" "RSVGTipsDevice"

[43] "RWinEdt" "rzmq"

[45] "translate" "TSMySQL"

[47] "WideLM" "xgobi"