Learn R Programming

ePCR (version 0.11.0)

interact.part: 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)

Value

A data matrix with multiplied columns as indicated using the sets 'first' and '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

Examples

Run this code
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

Run the code above in your browser using DataLab