Manual installation

I have created a small repository for those packages which I have not yet submitted to CRAN. This repository follows the CRAN folder structure, so package installation can be done using just the normal R commands. This means that dependencies are installed automatically, and that automatic updates are possible. The build most suitable for the current system and R version is also picked automatically if available. It is normally recommended that you do installs and updates on a clean R session (just after starting R or RStudio).

The examples given in this page assume that ‘r4photobiology’ is not in the list of repositories known to the current R session. See the page  r4photo repository for a much easier way of installing and updating our packages.

To install the latest released version of one package (photobiology used as example) you just need to indicate the repository. However this simple command will only install the dependencies bewteen the different photobiology packages.
install.packages("photobiology", repos = "")

To update what is already installed, this command is enough (even if the packages have been installed manually before):
update.packages(repos = "")
The best way to install the packages is to specify both my repo and a normal CRAN repo, then all dependencies will be automatically installed. The package r4photobiology just loads and imports four packages in the suite.

repos = c(r4photobiology = "", CRAN = ""))

The next example also shows how one can use an array of package names (in this example all my currently available photobiology-related packages) in the call to the function install.packages(), this is useful if you want to install only a subset of the files, or if you want to make sure that any older install of the packages is overwritten:
photobiology_packages <-
c("photobiology", "ggspectra", "photobiologyWavebands",
"photobiologyPlants", "photobiologyLamps", "photobiologyLEDs",
"photobiologySun", "photobiologyFilters", "photobiologySensors",
install.packages(photobiology_packages, repos = c(r4p = "",
CRAN = ""))

The commands above install all my packages and all their dependencies from CRAN if needed. The following command will update all the packages currently installed (if new versions are available) and install any new dependencies.
update.packages(repos = c(r4p = "", CRAN = ""))
The instructions above should work under Windows as long as you have a supported version of R (3.2.0 or later) because I have built suitable binaries, under other OS you may need to add type="source" unless this is already the default. We will try to build OS X binaries for Mac so that installation is easier. Meanwhile if installation fails try adding type="source" to the commands given above. For example the first one would become:
install.packages("photobiology", repos = "", type="source")
When using type = "source" you may need to install some dependencies like the ‘splus2R’ package beforehand from CRAN if building it from sources fails. For building from sources you will also need to have installed in your computer the required build tools. For example, under Windows ‘Rtools’ which is not an R package but rather a set of programs.

To install really the versions I am working on, which can be severely buggy at times, you can use function install_bitbucket() from package ‘devtools’.


Share with

Leave a Reply