R/utils.R

#' Convert a matrix with rownames into an indexed data.frame
#'
#' @param mtx matrix with rownames
#'
#' @return data.frame with column "id" containing mtx's rownames
#' @export
mtx2idf <- function(mtx) {
    stopifnot(is.matrix(mtx))
    mtx %>%
        as.data.frame() %>%
        tibble::rownames_to_column("id")
}
mbadge/AnalysisToolkitR documentation built on May 27, 2019, 1:08 p.m.