Skip to contents

Function to set by reference the "solute.properties" attribute of an existing solute_spct object.

Usage

setSoluteProperties(
  x,
  solute.properties = NULL,
  pass.null = FALSE,
  mass = NA_real_,
  formula = NULL,
  structure = grDevices::as.raster(matrix()),
  name = NA_character_,
  ID = NA_character_,
  solvent.name = NA_character_,
  solvent.ID = NA_character_
)

solute_properties(x) <- value

Arguments

x

solute_spct A spectrum of coefficients of attenuation.

solute.properties, value

a list with fields named "mass", "formula", "structure", "name" and "ID".

pass.null

logical If TRUE, the parameters to the next three parameters will be always ignored, otherwise they will be used to build an object of class "solute.properties" when the argument to solute.properties is NULL.

mass

numeric The mass in Dalton [\(Da = g\,mol^{-1}\)].

formula

character The molecular formula.

structure

raster A bitmap of the structure.

name, solvent.name

character The name of the substance and the name of the solvent. A named character vector, with member names such as "IUPAC" for the authority.

ID, solvent.ID

character The names of the substance and of the solvent. A named character vector, with member names such as "ChemSpider" or "PubChen" for the authority.

Value

x

Details

Storing solute properties allows inter-conversion between bases of expression, and ensures the unambiguous identification of the substances to which the spectral data refer. These properties make it possible to compute filter_spct objects for solutions of the solute, i.e., absorption spectra of liquid filters. The parameter pass.null makes it possible to remove the attribute. The solvent used for the determination of the attenuation coefficient is important metadata as the solvent can alter the spectral ansorption properties of the solute.

Note

This function alters x itself by reference and in addition returns x invisibly. If x is not a filter_spct object, x is not modified.

Examples


solute.properties <-
  list(formula = c(text = "H2O", html = "H<sub>2</sub>", TeX = "$H_2O$"),
       name = c("water", IUPAC = "oxidane"),
       structure = grDevices::as.raster(matrix()),
       mass = 18.015, # Da
       ID = c(ChemSpider = "917", CID = "962"),
       solvent.name = NA_character_,
       solvent.ID = NA_character_)
my.spct <- solute_spct()
solute_properties(my.spct) <- solute.properties
solute_properties(my.spct)
#> Name: water, Molar mass (Da): 18.02, Formula: H2O.
solute_properties(my.spct) <- NULL
solute_properties(my.spct)
#> Name: NA, Molar mass (Da): NA, Formula: NA.
solute_properties(my.spct, return.null = TRUE)
#> NULL
solute_properties(my.spct)
#> Name: NA, Molar mass (Da): NA, Formula: NA.