read_metadata: Reads metadata from a CSV file

View source: R/reading_data.R

read_metadataR Documentation

Reads metadata from a CSV file

Description

Reads metadata from a CSV file and returns it as a data frame.

Usage

read_metadata(filename, header.col = TRUE, header.row = TRUE, sep = ",")

Arguments

filename

Path to the metadata CSV file.

header.col

Logical; whether the metadata file has a header row.

header.row

Logical; whether the metadata file has a row names column.

sep

Field separator used in the metadata file.

Value

A data.frame containing the imported metadata. Rows usually correspond to samples and columns correspond to metadata variables.

Examples

meta_file <- tempfile(fileext = ".csv")
metadata_in <- data.frame(
  class = c("A", "B", "A"),
  batch = c("b1", "b1", "b2"),
  row.names = c("s1", "s2", "s3")
)
utils::write.csv(metadata_in, meta_file)
read_metadata(meta_file, header.row = TRUE)


specmine documentation built on Aug. 5, 2026, 5:06 p.m.