Learn R Programming

Rtrack (version 1.0.7)

subset_experiment: Subset an experiment.

Description

Creates a new experiment object that is a subset of another.

Usage

subset_experiment(experiment, tracks = "all")

Value

An rtrack_experiment containing a subset of the metrics, factors (and strategies if present in the original object).

Arguments

experiment

An rtrack_experiment object from read_experiment.

tracks

Which tracks should be retained in the subset. Default, 'all', will return the same experiment object. A subset of tracks can be specified using either numeric indices or a vector of track IDs following usual R standards.

Examples

Run this code
require(Rtrack)
experiment.description <- system.file("extdata", "Minimal_experiment.xlsx",
  package = "Rtrack")
experiment <- read_experiment(experiment.description, format = "excel",
  project.dir = system.file("extdata", "", package = "Rtrack"))
# The code below returns an experiment object only containing strain "B6". 
# Use the parameter 'file' to write to a file instead.
b6.tracks = experiment$factors$Strain == "B6"
b6.experiment = subset_experiment(experiment, tracks = b6.tracks)

Run the code above in your browser using DataLab