Reconstruct dqmask as a ts or mts object
get_dqmask.RdConverts the `dqmask` metadata attribute stored in an object (typically removed from `ts` class during storage) back to a formal time‑series (`ts` or `mts`) object. Uses the stored `tsp` attribute (or fallback to the parent object’s `tsp`) to reconstruct the appropriate start, end, and frequency information.
Arguments
- obj
An R object (e.g. returned by
read_H5()) containing an attribute named"dqmask", which is either a numeric vector or a numeric matrix/array (multi‑series).
Value
A ts object for univariate data or mts object for
multivariate data, reconstructed using tsp and with
the original "level" attribute re‑attached. Returns NULL
if dqmask is missing or NULL.
Details
This helper retrieves dqmask from obj, determines the appropriate
time-series parameters via tsp(obj) or tsp(dqmask), and then recreates
the time-series using ts(). The original
"level" attribute (e.g. "all" vs specific level) is preserved.
Examples
if (FALSE) { # \dontrun{
# Example for univariate case:
res <- read_H5("example.h5", sampling.freq = 1000, dq.level = "CAT1")
dq_ts <- get_dqmask(res)
print(dq_ts)
# Example for multivariate case:
res2 <- read_H5("example_multi.h5", sampling.freq = 1000, dq.level = "all")
dq_ts2 <- get_dqmask(res2)
str(dq_ts2)
} # }