Personal CRAN-repository

[This article was first published on G-Forge » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 their blog: G-Forge » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)