pkgdown/extra.css

Skip to contents

[Experimental]

tbl_now_from_data_table() converts a data.table into a tbl_now (requires explicit event_date / report_date columns). tbl_now_to_data_table() strips the tbl_now class and returns a data.table keeping every column; any lazy temporal effects are materialised first (see compute_temporal_effects()) so their columns are present.

Usage

tbl_now_from_data_table(data, event_date, report_date, ..., verbose = TRUE)

tbl_now_to_data_table(x, ..., verbose = TRUE)

Arguments

data

A data.table.

event_date, report_date

Column names (passed to as_tbl_now()).

...

Forwarded to as_tbl_now() (from) or data.table::as.data.table() (to).

verbose

Logical. Print the choices that were made.

x

A tbl_now object.

Value

A tbl_now (from) or a data.table (to).

Examples

data(denguedat)
dt <- data.table::as.data.table(denguedat)
nowobj <- tbl_now_from_data_table(dt,
  event_date = "onset_week",
  report_date = "report_week", verbose = FALSE
)