

You only need to do this once for each repo: pkgAvail( Then, check to make sure each miniCRAN repo has been created. You only need to execute the code above once for each repo. To see what packages are in your repository, run the following code and take a look at the resulting data frame: my_packages /R", This will generate the PACKAGE files that serve as the repository index. Next, create the repository index with the following code: tools::write_PACKAGES("//R/src/contrib", verbose = TRUE) Additional repositories can be included in the addURLs = option and are comma separated within the character vector. Ind = 0 will indicate that you only want the local repository. Rprofile for a local repository: utils::setRepositories(ind = 0, addURLs = c(WORK = "file:///R"))

I'd recommend adding the following code to your. Once you've added package files to the "contrib" directory, you can use the setRepositories function from the utils package to create the repository. All of your R packages files will be stored in the "contrib" directory.

If you don't have this path and these directories, you'll need to create them. As a result, these are some steps I've found to be helpful.įirst, you'll want to make sure you have the following path and its directories in your system: "/R/src/contrib". I also don't have access to CRAN mirrors for package installation.

Which I even do in R/zzz.R for local packages so that they update themselves.Įdit some five+ years later: And the drat package now automates a lot of this, and shines particularly if you also use GitHub to serve the repository over http/https (but is useful for other or local hosting too). That is all there is to it - now you can access the repository by pointing to the address given a command such as update.packages(repos="", ask=FALSE) Tools::write_PACKAGES(".", type="win.binary") Place the packages you need into the directory (say, 2.11), then change into that directory and run the following command to generate PACKAGES and PACKAGES.gz files for the repository: If you need to support other (earlier) releases, simply create directories 2.10, 2.9. Create the usual hierarchy in there: R/bin/windows/contrib/2.11.Create a top-level directory on your webserver, say R/.Presumably you want this for Windows so do this: Yes, either a copy of CRAN or a repo with local packages is easy to set up.
