interact.all: Compute all pairwise interactions between the columns of a...

View source: R/int.R

interact.allR Documentation

Compute all pairwise interactions between the columns of a data matrix

Description

The function multiplies the columns (variables) of a matrix or a data.frame with each other, and produces a new matrix where all pairwise interactions are present. This also includes multiplying a column with its self, thus effectively returning a squared column.

Usage

interact.all(input)

Arguments

input

A data matrix (of class matrix or data.frame) for which all column-wise multiplications are to be computed

Value

A matrix where columns of the original data matrix have been multiplied, indicating column names coupled with a colon in-between

Examples

set.seed(1)
somedata <- data.frame(a = rnorm(10), b = rnorm(10), c = runif(10), d = runif(10))
somedata
allinteract <- interact.all(somedata)
allinteract

Syksy/ePCR documentation built on Feb. 20, 2024, 10:16 p.m.