pairMatrix: Apply a function to all unique pairs of row indices up to...

Description Usage Arguments Value

View source: R/row_pair_apply.R

Description

Apply a function to all unique pairs of row indices up to num_row.

Usage

1
pairMatrix(num_row, pair_evaluator_fn, also_reverse_row_pairs = FALSE)

Arguments

num_row

The number of rows to generate index pairs for.

pair_evaluator_fn

The function you want applied. It should accept a list of two numbers, the index of row 1 and the index of row2.

also_reverse_row_pairs

Optional parameter. When it has its default value of FALSE, it will apply every function only once to any given row pair, e.g. myFunction(1, 2). When it is true, it will also apply the function to every reverse row pair, e.g. myFunction(1, 2) and myFunction(2, 1).

Value

A matrix of the output of the function for all unique row pairs: c(pair_evaluator_fn(c(1,2), pair_evaluator_fn(c(1,3)), etc.)


heuristica documentation built on Sept. 8, 2021, 9:08 a.m.