remove_data: Remove data

View source: R/filter_dataset.R

remove_dataR Documentation

Remove data

Description

Removes selected samples, data variables, or metadata variables from a dataset.

Usage

remove_data(
  dataset,
  data.to.remove,
  type = "sample",
  by.index = FALSE,
  rebuild.factors = TRUE
)

Arguments

dataset

Dataset to modify.

data.to.remove

Data to remove.

type

One of "sample", "data", or "metadata".

by.index

Logical. If TRUE, data.to.remove has indexes.

rebuild.factors

Logical. If TRUE, rebuild factors in metadata.

Value

A dataset object with the same overall structure as the input, where the requested samples, data variables, or metadata variables have been removed according to 'type'.

Examples

data <- matrix(
  1:9,
  nrow = 3,
  dimnames = list(c("x1", "x2", "x3"), c("s1", "s2", "s3"))
)
metadata <- data.frame(class = c("A", "B", "A"), row.names = c("s1", "s2", "s3"))
dataset <- list(data = data, metadata = metadata)
remove_data(dataset, "s2", type = "sample")


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