extract_pairs: Extract Pairs from a Path of Indices

View source: R/zenpath.R

extract_pairsR Documentation

Extract Pairs from a Path of Indices

Description

Extracts pairs from a path of indices, representing the path by the pairs (connected by common variable) and return a shortened path.

Usage

extract_pairs(x, n)

Arguments

x

the path, a vector or list of indices of the variables to be plotted.

n

A vector of length two giving the number of pairs to extract from the path x (if NULL, all pairs are returned (nothing extracted); if of length one, it is replicated in the pair). The first number corresponds to the beginning of the path, the second to the end; at least one of the two numbers should be >= 1.

Value

returns an object of the same type as the input x but (possibly) shortened. It extracts the first/last so-many pairs of x.

Author(s)

Marius Hofert and Wayne Oldford

See Also

zenplot() which provides the zenplot.

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

Examples

## Begin with a path
(zp <- zenpath(c(3, 5), method = "eulerian.cross")) # integer(2) argument

## Extract the first two pairs and last four of indices
extract_pairs(zp, n = c(2, 4))

## Extract the first and last three pairs of indices
extract_pairs(zp, n = 3) # the 3 is repeated automatically



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