read_CIE_csv: Read '.CSV' files from CIE

View source: R/read-cie-csv.r

read_CIE_csvR 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 NULL metadata read from the JSON file is used, and if NA the "what.measured" attribute is not set, and if a character string is passed, it is used to set the "what.measured" attribute.

simplify

logical If TRUE and the read file contained a single spectrum, extract the spectral object from the collection.

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

https://cie.co.at/data-tables

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
   

photobiologyInOut documentation built on Sept. 14, 2024, 5:06 p.m.