Method to set by reference the "when.measured" attribute of an R
object.
Usage
setWhenMeasured(x, when.measured, ...)
when_measured(x) <- value
# Default S3 method
setWhenMeasured(x, when.measured, ...)
# S3 method for class 'generic_spct'
setWhenMeasured(x, when.measured = lubridate::now(tzone = "UTC"), ...)
# S3 method for class 'summary_generic_spct'
setWhenMeasured(x, when.measured = lubridate::now(tzone = "UTC"), ...)
# S3 method for class 'data.frame'
setWhenMeasured(x, when.measured = lubridate::now(tzone = "UTC"), ...)
# S3 method for class 'generic_mspct'
setWhenMeasured(x, when.measured = lubridate::now(tzone = "UTC"), ...)Details
This method alters x itself by reference and in addition
returns x invisibly. If x is not an object of a supported
class, x is not modified. If the arguments to "when.measured"
or value are not a POSIXct object or NULL an error is
triggered. A POSIXct describes an instant in time (date plus
time-of-day plus time zone).
Be aware that lubridate::ymd() returns an incompatible Date
object while lubridate::ymd_h(), lubridate::ymd_hm() and
lubridate::ymd_hms() and similar functions return objects of class
POSIXct acceptable as arguments for parameter when.measured.
Methods (by class)
setWhenMeasured(default): defaultsetWhenMeasured(generic_spct): generic_spctsetWhenMeasured(summary_generic_spct): summary_generic_spctsetWhenMeasured(data.frame): data.framesetWhenMeasured(generic_mspct): generic_mspct
See also
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(),
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
