R - Formula ( ~ tilde)

> Procedural Languages > R

1 - About

A formula in S is indicated by the ~ character.

?formula

Advertising

3 - Design Matrix

A formula is commonly used to generate design matrices for modeling function (e.g. lm).

mod1 <- lm(Sepal.Width ~ Petal.Width + log(Petal.Length) + Species, 
           data = iris, subset = Sepal.Length > 4.6)

4 - Documentation / Reference