R/bb_tbl_to_matrix.R

Defines functions bb_tbl_to_matrix

Documented in bb_tbl_to_matrix

#' Convert a wide-form tibble a matrix 
#' 
#' @param data A wide form tibble to convert to a matrix.  The first column will become the rownames. 
#' @return A matrix 
#' @export
#' @import dplyr
bb_tbl_to_matrix <- function(data) {
  data <- data %>%
    as.data.frame()
  rownames(data) <- data[,1]
  return(as.matrix(data[,-1]))
}
blaserlab/blaseRtools documentation built on April 14, 2025, 6:04 p.m.