R/dt_to_df.R

Defines functions dt_to_df

Documented in dt_to_df

#' Convert a \code{data.table} to a \code{data.frame}.
#'
#' Converts a \code{data.table} to a \code{data.frame} by setting the
#'  first column as the rownames.
#'  
#' @return \link[base]{data.frame}
#'
#' @keywords internal
dt_to_df <- function(exp) {
    if (methods::is(exp, "data.table")) {
        col1 <- colnames(exp)[1]
        exp <- data.frame(exp,
            row.names = col1,
            check.rows = FALSE,
            check.names = FALSE
        )
    }
    return(exp)
}
NathanSkene/EWCE documentation built on April 10, 2024, 1:02 a.m.