make_sq_inter: Squares and two-way interactions of variables

Description Usage Arguments Value Author(s) Examples

View source: R/design_assessment.R

Description

Generates squares and/or two-way interactions (pairwise products) of the columns of a data frame.

Usage

1
2
3
4
5
6
make_sq_inter(
  data_frame,
  is_square = TRUE,
  is_inter = TRUE,
  keep_marginal = TRUE
)

Arguments

data_frame

Data frame containing the variables whose squares and interactions are to be created.

is_square

If TRUE, square of each column of data_frame is created.

is_inter

If TRUE, product of every pair of columns of data_frame is created.

keep_marginal

If TRUE, the original columns of data_frame are retained in the resulting data frame.

Value

A data frame containing the squares and/or pairwise products of data_frame.

Author(s)

Ambarish Chattopadhyay, Carl N. Morris and Jose R. Zubizarreta.

Examples

1
2
3
4
5
6
# Consider a data frame with N = 12 units and 2 covariates.
data_frame_sample = data.frame(male = c(rep(1,6),rep(0,6)), 
age = c(20,30,40,40,50,60,20,30,40,40,50,60))
# Get a data frame with all possible squares and first order interactions.
make_sq_inter(data_frame = data_frame_sample, is_square = TRUE, 
is_inter = TRUE, keep_marginal = FALSE)

FSM documentation built on March 11, 2021, 1:06 a.m.

Related to make_sq_inter in FSM...