read_dataset_csv: Reads a dataset from CSV files

View source: R/reading_data.R

read_dataset_csvR Documentation

Reads a dataset from CSV files

Description

Reads a dataset from a CSV file containing the data matrix and, optionally, a second CSV file containing metadata.

Usage

read_dataset_csv(
  filename.data,
  filename.meta = NULL,
  type = "undefined",
  description = "",
  label.x = NULL,
  label.values = NULL,
  sample.names = NULL,
  format = "row",
  header.col = TRUE,
  header.row = TRUE,
  sep = ",",
  header.col.meta = TRUE,
  header.row.meta = TRUE,
  sep.meta = ","
)

Arguments

filename.data

Path to the CSV file containing the data matrix.

filename.meta

Optional path to the CSV file containing metadata.

type

Character string describing the dataset type.

description

Character string with a dataset description.

label.x

Optional x-axis label.

label.values

Optional value labels.

sample.names

Optional sample names.

format

Data layout format, either "row" or "col".

header.col

Logical; whether the data file has a header row.

header.row

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

sep

Field separator used in the data file.

header.col.meta

Logical; whether the metadata file has a header row.

header.row.meta

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

sep.meta

Field separator used in the metadata file.

Value

An object of class dataset created from the input files. This object contains the imported data matrix and, if provided, the sample metadata, together with dataset-level information such as type, description, labels, and sample names. The returned object is intended to be used as input to downstream processing and analysis functions in the package.

Examples

data_file <- tempfile(fileext = ".csv")
meta_file <- tempfile(fileext = ".csv")

data_in <- data.frame(
  x1 = c(1.1, 2.2, 3.3),
  x2 = c(4.4, 5.5, 6.6),
  row.names = c("s1", "s2", "s3")
)
metadata_in <- data.frame(
  class = c("A", "B", "A"),
  row.names = c("s1", "s2", "s3")
)

utils::write.csv(data_in, data_file)
utils::write.csv(metadata_in, meta_file)

dataset <- read_dataset_csv(
  filename.data = data_file,
  filename.meta = meta_file,
  format = "row",
  header.row = TRUE,
  header.row.meta = TRUE
)
class(dataset)


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