R/cw_matrix_to_df.R

Defines functions cw_matrix_to_df

Documented in cw_matrix_to_df

#' function that turn matrix into a data.frame in long format
#'
#' @param x the data.frame to transform
#'
#'
cw_matrix_to_df <- function(x){
  data.frame(
    row = as.vector(row(x)),
    col = as.vector(col(x)),
    val = as.vector(x),
    stringsAsFactors = FALSE
  )
}

Try the crossword.r package in your browser

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

crossword.r documentation built on May 2, 2019, 12:34 p.m.