View source: R/methods-epi_archive.R
epix_fill_through_version | R Documentation |
epi_archive
unobserved historyThis function fills in missing version history in an epi_archive
object up
to a specified version, updating the versions_end
field as necessary. Note
that the filling is done in a compactified way, see details.
epix_fill_through_version(x, fill_versions_end, how = c("na", "locf"))
x |
An |
fill_versions_end |
a scalar of the same class&type as |
how |
Optional; |
Note that we generally store epi_archive
's in a compacted form, meaning
that, implciitly, if a version does not exist, but the version_end
attribute is greater, then it is understood that all the versions in between
had the same value as the last observed version. This affects the behavior of
this function in the following ways:
if how = "na"
, then the function will fill in at most one missing version
with NA
and the rest will be implicit.
if how = "locf"
, then the function will not fill any values.
An epi_archive
An epi_archive
test_date <- as.Date("2020-01-01")
ea_orig <- as_epi_archive(data.table::data.table(
geo_value = "ak",
time_value = test_date + c(rep(0L, 5L), 1L),
version = test_date + c(1:5, 2L),
value = 1:6
))
epix_fill_through_version(ea_orig, test_date + 8, "na")
epix_fill_through_version(ea_orig, test_date + 8, "locf")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.