R/as.data.table.R

Defines functions as.data.table.incidence2

Documented in as.data.table.incidence2

#' @importFrom data.table as.data.table
#' @export
data.table::as.data.table


#' Coerce to a data.table
#'
# -------------------------------------------------------------------------
#' @param x An [incidence2][incidence2::incidence] object.
#'
#' @param keep.rownames Not used.
#'
#' @param ... Passed to other methods.
#'
# -------------------------------------------------------------------------
#' @return
#' A [data.table][data.table::data.table] of the original input but with no
#' additional attributes.
#'
# -------------------------------------------------------------------------
#' @examples
#' \dontshow{.old <- data.table::setDTthreads(2)}
#' 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)
#' }
#' \dontshow{data.table::setDTthreads(.old)}
#'
# -------------------------------------------------------------------------
#' @seealso [data.table::as.data.table] for the underlying generic.
#'
# -------------------------------------------------------------------------
#' @export
as.data.table.incidence2 <- function(x, keep.rownames, ...) {
    x <- as.data.frame(x)
    NextMethod()
}

Try the incidence2 package in your browser

Any scripts or data that you put into this service are public.

incidence2 documentation built on June 22, 2024, 11:05 a.m.