spct_metadata: Access metadata

View source: R/spct.metadata.r

spct_metadataR Documentation

Access metadata

Description

Return metadata attributes from a single spectrum or a collection of spectra as a tibble.

Usage

spct_metadata(
  x,
  col.names = NULL,
  idx = "spct.idx",
  na.rm = is.null(col.names),
  unnest = TRUE
)

Arguments

x

generic_mspct or generic_spct Any collection of spectra or spectrum.

col.names

named character vector Name(s) of column(s) to create.

idx

character Name of the column with the names of the members of the collection of spectra.

na.rm

logical Flag controlling deletion of columns containing only NA values.

unnest

logical Flag controlling if metadata attributes that are lists of values should be returned in a list column or in separate columns.

Details

Attributes are returned as columns in a tibble. If the argument to col.names is a named vector, with the names of members matching the names of attributes, then the values are used as names for the columns created. This permits setting any valid name for the new columns. If the vector passed to col.names has no names, then the values are interpreted as the names of the attributes to add, and also used as names for the new columns.

Some metadata values are stored in lists or data frames, these can be returned as a list columns or the individual fields unnested into separate columns.

Value

A tibble With the metadata attributes and an index column.

See Also

add_attr2tb for more details.

Other measurement metadata functions: add_attr2tb(), getFilterProperties(), getHowMeasured(), getInstrDesc(), getInstrSettings(), getSoluteProperties(), getWhatMeasured(), getWhenMeasured(), getWhereMeasured(), get_attributes(), isValidInstrDesc(), isValidInstrSettings(), select_spct_attributes(), setFilterProperties(), setHowMeasured(), setInstrDesc(), setInstrSettings(), setSoluteProperties(), setWhatMeasured(), setWhenMeasured(), setWhereMeasured(), spct_attr2tb(), subset_attributes(), trimInstrDesc(), trimInstrSettings()

Examples


my.mspct <- source_mspct(list(sun1 = sun.spct, sun2 = sun.spct * 2))

spct_metadata(my.mspct)

spct_metadata(sun.spct)

spct_metadata(my.mspct, na.rm = TRUE)

spct_metadata(sun.spct, na.rm = TRUE)

spct_metadata(my.mspct, col.names = c(geocode = "geo", "instr.desc"))

spct_metadata(sun.spct, col.names = c(geocode = "geo", "instr.desc"))

spct_metadata(sun.spct, col.names = "where.measured")$where.measured


aphalo/photobiology documentation built on April 1, 2024, 6:48 p.m.