Personal CRAN-repository

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

flattr this!

This entry was posted in R. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>