MzQCDateTime | R Documentation |
An mzQC-formatted date+time in ISO8601 format, as required by the mzQC spec doc.
An mzQC-formatted date+time in ISO8601 format, as required by the mzQC spec doc.
The format is "%Y-%m-%dT%H:%M:%S".
datetime
A correctly formatted date time (use as read-only)
new()
Constructor
MzQCDateTime$new(date = as.character(Sys.time()))
date
Optional POSIXct value for initialization of field datetime. Defaults to Sys.time()
set()
Sets datetime value
MzQCDateTime$set(date)
date
New date-time
isValid()
Verifies validity of the object
MzQCDateTime$isValid(context = "MzQCDateTime")
context
Optional string describing location in mzQC structure that is used for more informative warning texts.
toJSON()
Creates JSON file from this object.
MzQCDateTime$toJSON(...)
...
Optional parameters for jsonlite:::asJSON()
fromData()
Sets data for this object from plain named lists of R objects
MzQCDateTime$fromData(data, context = "MzQCDateTime")
data
A datastructure of R lists/arrays as obtained by 'jsonlite::fromJSON()'
context
Optional string describing location in mzQC structure that is used for more informative warning texts.
clone()
The objects of this class are cloneable with this method.
MzQCDateTime$clone(deep = FALSE)
deep
Whether to make a deep clone.
dt1 = MzQCDateTime$new("1900-01-01") ## yields "1900-01-01T00:00:00Z"
dt2 = MzQCDateTime$new(Sys.time())
## test faulty input
## errors with 'character string is not in a standard unambiguous format'
try(MzQCDateTime$new('lala'), silent=TRUE)
## test roundtrip conversion from/to JSON
dt2$fromData(jsonlite::fromJSON(jsonlite::toJSON(dt1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.