Skip to contents

Returns the formula of an intercept-only model (. ~ 1) if the original formula x contains an intercept and the constant zero-model formula (. ~ 0) otherwise.

Usage

null_formula(x)

Arguments

x

Any object having a formula method and an update method accepting updating formula as second argument.

Value

Returns a simple (“null”) formula.

See also

Used as default value of argument “formula1” in stepwise functions.

Examples

null_formula(lm(Sepal.Length ~ ., iris))
#> Sepal.Length ~ 1
#> <environment: 0x56188cb03e98>