Method to read the "when.measured" attribute of an R object.
Usage
getWhenMeasured(x, ...)
when_measured(x, ...)
# Default S3 method
getWhenMeasured(x, ...)
# S3 method for class 'generic_spct'
getWhenMeasured(x, as.df = FALSE, ..., simplify = FALSE)
# S3 method for class 'summary_generic_spct'
getWhenMeasured(x, as.df = FALSE, ..., simplify = FALSE)
# S3 method for class 'data.frame'
getWhenMeasured(x, as.df = FALSE, ..., simplify = FALSE)
# S3 method for class 'generic_mspct'
getWhenMeasured(x, ..., idx = "spct.idx", simplify = FALSE)Arguments
- x
an R object
- ...
Allows use of additional arguments in methods for other classes.
- as.df
logical If
TRUEreturn a data frame instead of a list, when the value stored in the attribute is a list.- simplify
logical If all members share the same attribute value return one copy instead of a data.frame.
- idx
character Name of the column with the names of the members of the collection of spectra.
Value
a POSIXct object with date and time, or named list of such
objects, or, on user request, a data frame.
Methods (by class)
getWhenMeasured(default): defaultgetWhenMeasured(generic_spct): generic_spctgetWhenMeasured(summary_generic_spct): summary_generic_spctgetWhenMeasured(data.frame): data.framegetWhenMeasured(generic_mspct): generic_mspct
Note
If x is not an object of one of the supported classes,
NA is returned.
The method for collections of spectra returns a tibble with the times expressed in TZ = "UTC".
See also
Other measurement metadata functions:
add_attr2tb(),
getFilterProperties(),
getHowMeasured(),
getInstrDesc(),
getInstrSettings(),
getSoluteProperties(),
getWhatMeasured(),
getWhereMeasured(),
get_attributes(),
isValidInstrDesc(),
isValidInstrSettings(),
select_spct_attributes(),
setFilterProperties(),
setHowMeasured(),
setInstrDesc(),
setInstrSettings(),
setSoluteProperties(),
setWhatMeasured(),
setWhenMeasured(),
setWhereMeasured(),
spct_attr2tb(),
spct_metadata(),
subset_attributes(),
trimInstrDesc(),
trimInstrSettings()
Examples
my.spct <- sun.spct
when_measured(my.spct)
#> [1] "2010-06-22 09:51:00 UTC"
when_measured(my.spct) <- lubridate::ymd_hms("2020-01-01 08:00:00")
when_measured(my.spct)
#> [1] "2020-01-01 08:00:00 UTC"
when_measured(my.spct) <- NULL
when_measured(my.spct)
#> [1] NA
