| convert_from_matrix | R Documentation |
This functions transforms a matrix holding a wide feature table into a "long" and tidy tibble to use it with functions provided in the metamorphr package.
convert_from_matrix works with objects of class matrix. To convert a data frame or tibble, see convert_from_wide.
convert_from_matrix(data, samples_in_cols = TRUE)
data |
A feature table matrix in wide format. To convert a wide data frame, see |
samples_in_cols |
|
A tidy tibble.
# Using a small fictional data set
dataset <- matrix(1:9, ncol = 3)
colnames(dataset) <- paste0("sample", 1:3)
rownames(dataset) <- paste0("feature", 1:3)
# Example 1: Samples in columns
dataset
convert_from_matrix(dataset)
# Example 2: Samples in rows
dataset_transposed <- t(dataset)
dataset_transposed
convert_from_matrix(dataset, samples_in_cols = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.