Personal CRAN-repository

November 24, 2012
By

(This article was first published on G-Forge » R, and kindly contributed to R-bloggers)

Offering – the backbone of open source. The image is CC by TenthMusePhotography

This is part II of the previous package creation post. I’ve created my own CRAN repository since I wanted a quick upload. Perhaps in the future I’ll post on the main server but right now it’s actually rather convenient, although it took me a while to figure out exactly how this works.

Start by following the previous post and create zip and tar.gz files by the R CMD external tools. Now create a directory structure on your local drive before uploading (if this is what you want) to a webserver. Make sure your directory name is in English or you might run into trouble, I use C:\Software\cran for my repository.

The basic idea of the directory structure should be like this:

\bin
\___\windows
\___________\contrib
\___________________\2.15
\___________________\2.16
\___________________\2.17 and so on
\src
\___\contrib

Note that the src\contrib doesn’t have any R versions in it. The install –build produces the .zip version that’s put into the bin directory while the build gives the source version, the .tar.gz.

There needs to be a package file (PACKAGES & PACKAGES.gz) in each directory, it’s easy to create using the write_PACKAGES as done below:

?View Code RSPLUS
1
2
3
4
5
6
7
8
9
10
11
12
library(tools)
# Prepare the binary
write_PACKAGES("C:\\Software\\cran",
               verbose=TRUE, subdirs=TRUE,
               type="win.binary")
write_PACKAGES("C:\\Software\\cran\\bin\\windows\\contrib\\2.15",
               verbose=TRUE, subdirs=TRUE,
               type="win.binary")
# Prepare the source catalog
write_PACKAGES("C:\\Software\\cran\\src\\contrib",
               verbose=TRUE, subdirs=TRUE,
               type="source")

To leave a comment for the author, please follow the link and comment on his blog: G-Forge » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.