R/df_2_mat.R

Defines functions df_2_mat

#' Convert a data.frame to a numeric matrix, using the first column as the
#' rownames.
#'
#' @param df A data.frame.
#'
#' @return A matrix.
#' @export
#'
#' @examples
df_2_mat <- function(df) {
  rn <- df[, 1]
  m <- as.matrix(df[, -1])
 	rownames(m) <- rn
  m
}
wkc1986/wkcr documentation built on May 5, 2019, 11:01 p.m.