convert_from_wide: Convert a wide feature table to a tidy tibble

View source: R/convert.R

convert_from_wideR Documentation

Convert a wide feature table to a tidy tibble

Description

Feature tables are usually stored in a "wide" data format where sample names are stored in columns and features are stored in rows. This functions transforms those feature tables into a "long" and tidy data format to use it with functions provided in the metamorphr package. convert_from_wide works with tibbles and data frames. To convert a matrix, see convert_from_matrix.

Usage

convert_from_wide(data, label_col = 1, metadata_cols = NULL)

Arguments

data

A feature table data frame or tibble in wide format. To convert a matrix, see convert_from_matrix.

label_col

The index or name of the column that will be used to label Features. For example an identifier (e.g., KEGG, CAS, HMDB) or a m/z-RT pair.

metadata_cols

The index/indices or name(s) of column(s) that hold additional feature metadata (e.g., retention times, additional identifiers or m/z values).

Value

A tidy tibble.

Examples

featuretable_path <- system.file("extdata", "toy_metaboscape.csv", package = "metamorphr")
featuretable_wide <- read.csv(featuretable_path)

convert_from_wide(featuretable_wide, metadata_cols = 2:5)


metamorphr documentation built on June 10, 2026, 5:07 p.m.