matrix_to_tibble: Convert between a mutation matrix and tibble

Description Usage Arguments Examples

View source: R/matrix_to_tibble.R

Description

While tibbles are great for interactive data science, matrices are more practical for the algebra used by WExT. Therefore, these two functions mutationmatrix_to_tibble() and tibble_to_mutationmatrix(), make switching between the two formats much easier.

Usage

1
matrix_to_tibble(dat, columns_name = "sample_id", rows_name = "gene")

Arguments

dat

a matrix object with column and row names

columns_name

title for the data in the column names (default "sample_id")

rows_name

title for the data in the row names (default "gene")

Examples

1
2
3
4
5
set.seed(0)
mat <- matrix(sample(c(0,1), 12, replace = TRUE), nrow = 3)
colnames(mat) <- LETTERS[1:4]
rownames(mat) <- letters[1:3]
matrix_to_tibble(mat)

jhrcook/wext documentation built on May 17, 2021, 1:19 a.m.