read_CIE_csv {photobiologyInOut} | R Documentation |
Read '.CSV' files from CIE
Description
Reads a CSV spectral data file and its companion JSON file with metadata as published by International Commission on Illumination (CIE) and then imports wavelengths and spectral values into one the classes for spectral data defined in package 'photobiology.
Usage
read_CIE_csv(file.name, label = NULL, simplify = FALSE)
Arguments
file.name |
character string |
label |
character string, but if |
simplify |
logical If |
Details
The CSV file contains only numbers encoded as character strings, and the
JSON file contains extensive metadata. The type of spectral data is encoded
as part of the file name. If the original file name of the CSV file is passed
as argument to parameter file
, the function can retrieve all data and
metadata, enough to return an R object of the correct class. The JSON file
must be located in the same folder.
Value
Depending on the contents of the file, a source_spct
object, a
response_spct
object, or a chroma_spct
object, containing
both data and metadata.
References
Examples
file.name <-
system.file("extdata", "CIE_illum_C.csv",
package = "photobiologyInOut", mustWork = TRUE)
CIE_illum_C.spct <- read_CIE_csv(file.name)
CIE_illum_C.spct
file.name <-
system.file("extdata", "CIE_sle_photopic.csv",
package = "photobiologyInOut", mustWork = TRUE)
CIE_sle_photopic.spct <- read_CIE_csv(file.name)
CIE_sle_photopic.spct