View source: R/reflow_fields.R
reflow_fields | R Documentation |
Reflow potentially invalid time components to adjacent fields
reflow_fields(fmat, days)
fmat |
a fields matrix as part of a partial_time or partial_difftime |
days |
a logical indicating whether year and month should be consolidated into total days. If an integer is provided, days should represent the "leap-time" to add on top of non-leap conversion. |
a fields matrix with appropriately ranged time components
# example with difftimes (when you only care about days of change)
x <- as.parttime("2019-06-23 04:33:21.123")
y <- as.parttime("2018-02-08 12:59:28.987")
diff_fields <- vctrs::field(x, "pttm_mat") - vctrs::field(y, "pttm_mat")
parttime:::reflow_fields(diff_fields)
# if we want to assume 0.25 leap days per year
parttime:::reflow_fields(diff_fields, days = TRUE)
# if we want to assert that there were no leap days
parttime:::reflow_fields(diff_fields, days = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.