View source: R/spct.metadata.r
| add_attr2tb | R Documentation |
generic_mspctCopy metadata attributes from members of a generic_mspct object into
a data.frame or a tibble.
add_attr2tb(
tb = NULL,
mspct,
col.names = NULL,
idx = "spct.idx",
unnest = FALSE
)
when_measured2tb(mspct, tb = NULL, col.names = "when.measured", idx = NULL)
geocode2tb(mspct, tb = NULL, col.names = "geocode", idx = "spct.idx")
lonlat2tb(mspct, tb = NULL, col.names = c("lon", "lat"), idx = "spct.idx")
lon2tb(mspct, tb = NULL, col.names = "lon", idx = "spct.idx")
lat2tb(mspct, tb = NULL, col.names = "lat", idx = "spct.idx")
address2tb(mspct, tb = NULL, col.names = "address", idx = "spct.idx")
what_measured2tb(
mspct,
tb = NULL,
col.names = "what.measured",
idx = "spct.idx"
)
how_measured2tb(mspct, tb = NULL, col.names = "how.measured", idx = "spct.idx")
normalized2tb(mspct, tb = NULL, col.names = "normalized", idx = "spct.idx")
scaled2tb(mspct, tb = NULL, col.names = "scaled", idx = "spct.idx")
instr_desc2tb(mspct, tb = NULL, col.names = "instr.desc", idx = "spct.idx")
instr_settings2tb(
mspct,
tb = NULL,
col.names = "instr.settings",
idx = "spct.idx"
)
BSWF_used2tb(mspct, tb = NULL, col.names = "BSWF.used", idx = "spct.idx")
filter_properties2tb(
mspct,
tb = NULL,
col.names = "filter.properties",
idx = "spct.idx"
)
solute_properties2tb(
mspct,
tb = NULL,
col.names = "solute.properties",
idx = "spct.idx"
)
Tfr_type2tb(mspct, tb = NULL, col.names = "Tfr.type", idx = "spct.idx")
Rfr_type2tb(mspct, tb = NULL, col.names = "Rfr.type", idx = "spct.idx")
time_unit2tb(mspct, tb = NULL, col.names = "time.unit", idx = "spct.idx")
comment2tb(mspct, tb = NULL, col.names = "comment", idx = "spct.idx")
multiple_wl2tb(mspct, tb = NULL, col.names = "multiple.wl", idx = "spct.idx")
tb |
tibble or |
mspct |
generic_mspct or generic_spct Any collection of spectra or one or more spectra in long form. |
col.names |
named |
idx |
character Name of the column with the names of the members of the collection of spectra. |
unnest |
logical Flag controlling if metadata attributes that are lists of values should be returned in a list column or in separate columns. |
Each attribute is by default copied to a column in a tibble
or a data.frame. If the argument for tb is NULL, as by
default, a new tibble will be created. If an existing
data.frame or tibble is passed as argument, new columns are
added to it. However, the number of rows in the argument passed to
tb must match the number of spectra in the argument passed to
mspct. Only in the case of methods add_attr2tb() and
spct_metadata() if the argument to col.names is a named
vector, the names of members are used as names for the columns created.
This permits setting any valid name for the new columns. If the members of
the vector passed to col.names have no names, then the value is
interpreted as the name of the attributes to add, and also used as name for
the new column.
Valid values accepted as argument to col.names are NULL, or a
vector containing one or more of the following character strings:
"lon", "lat", "address", "geocode",
"where.measured", "when.measured", "what.measured",
"how.measured", "comment", "normalised",
"normalized", "scaled", "bswf.used",
"instr.desc", "instr.settings", solute.properties,
"filter.properties", "Tfr.type", "Rfr.type",
"time.unit".
A data.frame or a tibble With the metadata attributes
in separate new variables.
The order of the first two arguments is reversed in
add_attr2tb(), when_measured2tb(), what_measured2tb(),
etc., compared to attribute query functions, such as spct_metadata,
when_measured(), what_measured(), how_measured(), etc.
This is to allow the use of add_attr2tb() in 'pipes' to add metadata
to summaries computed at earlier steps in the pipe.
Other measurement metadata functions:
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(),
spct_metadata(),
subset_attributes(),
trimInstrDesc(),
trimInstrSettings()
# Add attributes to irradiance
## from collection of spectra
e_irrad(sun_evening.mspct) |>
add_attr2tb(sun_evening.mspct,
c(when.measured = "time"))
## from spectra in long form
e_irrad(sun_evening.spct) |>
add_attr2tb(sun_evening.spct,
c(when.measured = "time"))
# Add attributes to transmittance
## from collection of spectra
transmittance(two_filters.mspct) |>
add_attr2tb(two_filters.mspct, col.names = "what.measured")
transmittance(two_filters.mspct) |>
add_attr2tb(two_filters.mspct,
col.names = c("filter.properties", "what.measured"),
unnest = TRUE)
# Create a new data frame
add_attr2tb(mspct = two_filters.mspct,
idx = "filter",
col.names = c("filter.properties", "what.measured"),
unnest = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.