extractIndices: Extract regression indices

Description Usage Arguments Value Examples

View source: R/utilities-covariance.R

Description

Function to obtain indices in data frame for dependent & independent variables from a formula.

Usage

1

Arguments

formula

An object of class 'formula' containing the desired regression formula.

data

A numeric data frame with at least two columns.

intercept

A logical vector indicating whether the intercept is included in formula.

Value

A named list with names corresponding to labels and locations (i.e., columns) for variables in the specification.

Examples

1
2
3
4
5
y <- rnorm(100) * 2
x <- (y + rnorm(100)) > 0
data <- data.frame(cbind(y, x))
f <- as.formula('y ~ x')
extractIndices(f, data, FALSE)

IQSS/PSI-Library documentation built on Feb. 15, 2020, 9:03 p.m.