Skip to contents

Coerce to a data.table

Usage

# S3 method for class 'incidence2'
as.data.table(x, keep.rownames, ...)

Arguments

x

An incidence2 object.

keep.rownames

Not used.

...

Passed to other methods.

Value

A data.table of the original input but with no additional attributes.

See also

data.table::as.data.table for the underlying generic.

Examples

if (requireNamespace("outbreaks", quietly = TRUE)) {
    data(ebola_sim_clean, package = "outbreaks")
    dat <- ebola_sim_clean$linelist
    x <- incidence(dat, "date_of_onset")
    as.data.table(x)
}
#>      date_index count_variable count
#>          <Date>         <char> <int>
#>   1: 2014-04-07  date_of_onset     1
#>   2: 2014-04-15  date_of_onset     1
#>   3: 2014-04-21  date_of_onset     2
#>   4: 2014-04-25  date_of_onset     1
#>   5: 2014-04-26  date_of_onset     1
#>  ---                                
#> 363: 2015-04-26  date_of_onset     9
#> 364: 2015-04-27  date_of_onset     7
#> 365: 2015-04-28  date_of_onset     8
#> 366: 2015-04-29  date_of_onset     2
#> 367: 2015-04-30  date_of_onset     2