interact.part: Compute a chosen set of pairwise interactions between two...

View source: R/int.R

interact.partR Documentation

Compute a chosen set of pairwise interactions between two sets of columns in a data matrix

Description

Similar to interact.all-function, but here user provides two sets of variables, and each pairwise combination between these two sets is multiplied. These pairwise interactions are then returned as a new data matrix, with a colon indicating which variables were multiplied.

Usage

interact.part(input, first, second)

Arguments

input

The input data matrix, of either class matrix or data.frame

first

The first set of columns to combine with each of the members of the second set, as either integers or column names

second

The second set of columns to combine with each of the members of the first set, as either integers or column names

Value

A data matrix with multiplied columns as indicated using the sets 'first' and 'second'

Examples

set.seed(1)
somedata <- data.frame(a = rnorm(10), b = rnorm(10), c = runif(10), d = runif(10))
somedata
someinteract <- interact.part(somedata, first = c("a", "b"), second = c("c", "d"))
someinteract

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