comb_matrix_to_df: Function to convert named matrix to colname-rowname dataframe

Description Usage Arguments Value Examples

View source: R/comb_matrix_to_df.R

Description

This function helps you to convert your matrix into dataframe if your matrix has colnames and rownames with value in it

Usage

1
2
3
4
5
comb_matrix_to_df(
  input.matrix = matrix(),
  colnames.first = TRUE,
  new.colnames = c("c", "r", "value")
)

Arguments

input.matrix

Matrix contains names and values

colnames.first

Whether in the return dataframe, the colnames of matrix should be the first col

new.colnames

The colnames of the return dataframe

Value

A dataframe contains colnames and rownames of the input matrix, as well as the value

Examples

1
2
3
4
5
6
7
## Not run: 
mx <- matrix(1:6, ncol=2)
colnames(mx) <- c("v1", "v2")
rownames(mx) <- c('r1', 'r2', 'r3')
print(comb_matrix_to_df(mx))

## End(Not run)

Ronlee12355/dfbmd documentation built on Sept. 23, 2020, 10:32 a.m.