Learn R Programming

specmine (version 4.0.0)

read_metadata: 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 = ",")

Value

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

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab