FindTriples: Find "triples" of vector elements.

FindTriplesR Documentation

Find "triples" of vector elements.

Description

FindTriples returns the number of left triples, right triples, and triples that are neither left nor right for the given vector.

Usage

FindTriples(z)

Arguments

z

Numeric vector

Details

Triples are formed by taking any three data values from a vector and order this triple of data values from smallest to largest. If the middle ordered item is closer to the smallest than to the largest, the triple is said to be a right triple. If the middle ordered item is closer to the largest, the triple is said to be a left triple. If the middle ordered value is exactly halfway between the other two, the triple is neither right nor left. This function will do the necessary computations and return the number of each type of triple.

Value

A list with three components:

  • right - Number of right triples (where middle value is closer to smallest)

  • left - Number of left triples (where middle value is closer to largest)

  • neither - Number of triples that are neither left nor right (where middle value is exactly halfway between the other two)

Examples

FindTriples(1:10)
FindTriples(rnorm(20))

IIS documentation built on April 3, 2025, 6:10 p.m.