addIndicators: Utility to add indicators from a data-frame based on a...

View source: R/addIndicators.R

addIndicatorsR Documentation

Utility to add indicators from a data-frame based on a formula.

Description

Column-bind a model matrix to the source data-frame

Usage

addIndicators(data, formula, drop.intercept = TRUE)

Arguments

data

source data-frame or matrix.

formula

model formula used to add columns.

drop.intercept

logical as to whether to drop the column named '(Intercept)'.

Details

This function calls model.matrix, conditionally checks for and removes '(Intercept)', and binds with the original data-frame (or matrix).

Value

data-frame or matrix.

Examples

addIndicators(data.frame(f = c("a","a","b")), ~f+0)

biostat3 documentation built on Nov. 2, 2023, 6:04 p.m.