# Usage is possible without pipes
zlm( cars, dist ~ speed )
# zfit works well with dplyr and magrittr pipes
if ( require("dplyr", warn.conflicts=FALSE) ) {
# Pipe cars dataset into zlm for fitting
cars %>% zlm(speed ~ dist)
# Process iris with filter before piping to zlm
iris %>%
filter(Species == "setosa") %>%
zlm(Sepal.Length ~ Sepal.Width + Petal.Width)
}
# zfit also works well with the native pipe
if ( require("dplyr") && getRversion() >= "4.1.0" ) {
# Pipe cars dataset into zlm for fitting
cars |> zlm(speed ~ dist)
# Process iris with filter() before piping. Print a
# summary of the fitted model using zprint() before
# assigning the model itself (not the summary) to m.
m <- iris |>
filter(Species == "setosa") |>
zlm(Sepal.Length ~ Sepal.Width + Petal.Width) |>
zprint(summary)
}
Run the code above in your browser using DataLab