Copy metadata attributes from members of a generic_mspct object into a tibble or data.frame.
add_attr2tb(
tb = NULL,
mspct,
col.names = NULL,
idx = "spct.idx",
unnest = FALSE
)when_measured2tb(
mspct,
tb = NULL,
col.names = "when.measured",
idx = "spct.idx"
)
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"
)
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")
tibble or data.frame to which to add the data (optional).
generic_mspct Any collection of spectra.
named character vector Name(s) of metadata attributes to copy, while if named, the names provide the name for the column.
character Name of the column with the names of the members of the collection of spectra.
logical Flag controlling if metadata attributes that are lists of values should be returned in a list column or in separate columns.
A tibble With the metadata attributes in separate new variables.
The attributes are copied to a column in a tibble or data frame. If
the tb formal parameter receives NULL as argument, 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 method add_attr2tb() 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
vector passed to col.names has no names the names of the attributes
are used for the new columns. If the fields of the attributes are unnested
their names are used as names for the columns.
Valid accepted as argument to col.names are NULL,
"lon", "lat", "address", "geocode",
"where.measured", "when.measured", "what.measured",
"how.measured", "comment", "normalised",
"normalized", "scaled", "bswf.used",
"instr.desc", "instr.settings", "filter.properties",
"Tfr.type", "Rfr.type", "time.unit".
Other measurement metadata functions:
getFilterProperties(),
getHowMeasured(),
getInstrDesc(),
getInstrSettings(),
getWhatMeasured(),
getWhenMeasured(),
getWhereMeasured(),
get_attributes(),
isValidInstrDesc(),
isValidInstrSettings(),
select_spct_attributes(),
setFilterProperties(),
setHowMeasured(),
setInstrDesc(),
setInstrSettings(),
setWhatMeasured(),
setWhenMeasured(),
setWhereMeasured(),
spct_attr2tb(),
spct_metadata(),
trimInstrDesc(),
trimInstrSettings()
# NOT RUN {
library(dplyr)
my.mspct <- source_mspct(list(sun1 = sun.spct, sun2 = sun.spct * 2))
q_irrad(my.mspct) %>%
add_attr2tb(my.mspct, c(lat = "latitude",
lon = "longitude",
when.measured = "time"))
when_measured2tb(my.mspct)
# }
Run the code above in your browser using DataLab