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