indexData: Indexing a Matrix or Data Frame According to Given Indices

View source: R/zenpath.R

indexDataR Documentation

Indexing a Matrix or Data Frame According to Given Indices

Description

Indexing a Matrix or Data Frame According to Given Indices

Usage

indexData(x, indices)

Arguments

x

A matrix or data.frame (most useful for the latter).

indices

vector of column indices of x (typically obtained from zenpath()).

Value

An object as x (typically a data.frame or matrix) containing x indexed by indices.

Note

Useful for constructing data.frames without .1, .2, ... in their names when indexing a data.frame with a zenpath.

Author(s)

Marius Hofert and Wayne Oldford

See Also

zenplot() which provides the zenplot.

Other tools related to constructing zenpaths: connect_pairs(), extract_pairs(), graph_pairs(), groupData(), zenpath()

Examples

## The function is handiest for data frames
## where we want to reuse the variable names
## without adding a suffix like ".1" etc.
## For example,
x <-  BOD  # Biochemical Oxygen Demand data in base R
indices <- rep(1:2, 2)
## now compare
indexData(x, indices)
## to
x[, indices]
## zenplots prefer not to have the suffixes.


zenplots documentation built on Nov. 8, 2023, 1:10 a.m.