README.md

spec.vis

Project Status: WIP – Initial development is in progress, but there
has not yet been a stable, usable release suitable for the
public. cran
version Build
Status Coverage
status cran
downloads

Spectral sensitivity data package

spec.vis is a mini-database and R data package of receptor absorbance and ocular transmission spectra with metadata, useful for visual/colorspace modelling among other things. It currently contains 410 spectra from 119 species.

Installation

To download the development version of spec.vis, you can:

# install.packages("remotes")
remotes::install_github("thomased/spec.vis")
install.packages(path, type = "source", repos = NULL)

Browsing and searching spectra

The entire database can be loaded into memory by simply calling data(specvis_spectra), along with the metadata data(specvis_meta) and dictionary data(specvis_dict).

Alternately, the specvis_search() function allows you to query the available data and return a select subset based on search terms (e.g. specvis_search(genus == 'bombus')), with the option of returning either raw spectra or metadata via the return.spectra argument.

Finally, if you’re not an R person, the ‘database’ boils down to a few text files located in the data.raw/ directory, which you’re free to download and use as you please.

Example

# Load packages
library(spec.vis)
library(pavo)

# Grab some spectra
apis <- specvis_search(genus == 'apis', species == 'mellifera', return.spectra = TRUE)
canis <- specvis_search(genus == 'canis', species == 'familiaris', return.spectra = TRUE)
bluetit <- specvis_search(genus == 'cyanistes', species == 'caeruleus', return.spectra = TRUE)

# Plot them
par(mfrow=c(1,3))
plot(as.rspec(canis), main = 'Canis familiaris', ylab = 'Absorbance', xlab = '')
plot(as.rspec(apis), ylab = '', main = 'Apis mellifera (f)')
plot(as.rspec(bluetit), ylab = '', main = 'Cyanistes caeruleus', xlab = '')

Example spectra available in the package.

Contributing

Contributions of spectra to the package are most welcome. There are a few ways to do so, from most- to least-involved:

Citing

If you find the package useful, please cite the original data source(s)and the spec.vis package (see citation("spec.vis") for the reference).



thomased/spec.vis documentation built on May 26, 2019, 10:36 a.m.