
Update a tbl_now
update.tbl_now.RdUsage
# S3 method for class 'tbl_now'
update(
object,
...,
new_data,
strata = "left",
covariates = strata,
t_effects = strata,
now = NULL,
remove_duplicates = NULL
)Arguments
- object
A
tbl_nowobject- ...
Additional arguments to pass to
tbl_now- new_data
Another
tbl_nowwith the samestrata,covariates,is_censored, andtemporal_effectsor adata.framewith additional (newer) data not present inx- strata
(optional) Whether to keep the strata from
object("left"), fromnew_data("right") or fromboth("both")- covariates
(optional) Whether to keep the covariates from
object("left"), fromnew_data("right") or fromboth("both")- t_effects
(optional) Which temporal-effects spec to keep: from
object("left", the default), fromnew_data("right") or the union of both ("both").- now
(optional) Date or
NULL(default). The date that is considered thenowof the nowcast. If nonowis given then the function automatically uses the lastevent_date.- remove_duplicates
Whether to remove duplicated rows from data (only applies for
countdata)
Note
By default it keeps the strata, covariates and temporal effects of object. Use
the strata, covariates and t_effects arguments to change it.
Examples
data(denguedat)
initial_data <- denguedat[1:500, ]
update_data <- denguedat[501:1000, ]
initial_tbl <- tbl_now(denguedat,
event_date = "onset_week",
report_date = "report_week", strata = "gender",
verbose = FALSE
)
# Update collapses everything into a single data.frame
update(initial_tbl, new_data = update_data)
#> # A tibble: 53,487 × 6
#> # Data type: "linelist"
#> # Frequency: Event: `weeks` | Report: `weeks`
#> onset_week report_week gender .event_num .report_num .delay
#> <date> <date> <chr> <dbl> <dbl> <dbl>
#> [event_date] [report_date] [strata] [...] [...] [...]
#> 1 1990-01-01 1990-01-01 Male 0 0 0
#> 2 1990-01-01 1990-01-01 Female 0 0 0
#> 3 1990-01-01 1990-01-01 Female 0 0 0
#> 4 1990-01-01 1990-01-08 Female 0 1 1
#> 5 1990-01-01 1990-01-08 Male 0 1 1
#> 6 1990-01-01 1990-01-15 Female 0 2 2
#> 7 1990-01-01 1990-01-15 Female 0 2 2
#> 8 1990-01-01 1990-01-15 Female 0 2 2
#> 9 1990-01-01 1990-01-22 Female 0 3 3
#> 10 1990-01-01 1990-01-08 Female 0 1 1
#> # ────────────────────────────────────────────────────────────────────────────────
#> # Now: 2010-12-20 | Event date: "onset_week" | Report date: "report_week"
#> # Strata: "gender"
#> # ────────────────────────────────────────────────────────────────────────────────
#> # ℹ 53,477 more rows