Learn R Programming

zfit (version 0.1.0)

zlm: Run an lm model in a pipe

Description

This function wraps around the lm function in order to make it more friendly to pipe syntax (with the data first)

Usage

zlm(data, formula, ...)

Arguments

data

A data.frame containing the model data.

formula

The formula to be fitted.

...

Other arguments to be passed to the lm function.

Value

A fitted model.

See Also

Other zfit: zglm(), zlogit(), zprint(), zprobit()

Examples

Run this code
# NOT RUN {
# Pipe cars dataset into zlm for fitting
cars %>% zlm( speed ~ dist )

# Process iris with filter before piping to zlm (requires dplyr)
if(require("dplyr")) {
  iris %>%
    filter(Species=="setosa") %>%
    zlm(Sepal.Length ~ Sepal.Width + Petal.Width)
}

# }

Run the code above in your browser using DataLab