Description Usage Arguments Details See Also Examples

`fit_with()`

is a pipe-friendly tool that applies a list of
formulas to a fitting function such as `lm()`

.
The list of formulas is typically created with `formulas`

().

1 |

`data` |
A dataset used to fit the models. |

`.f` |
A fitting function such as |

`.formulas` |
A list of formulas specifying a model. |

`...` |
Additional arguments passed on to |

Assumes that `.f`

takes the formula either as first argument
or as second argument if the first argument is `data`

. Most
fitting functions should fit these requirements.

`formulas`

()

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
# fit_with() is typically used with formulas().
disp_fits <- mtcars %>% fit_with(lm, formulas(~disp,
additive = ~drat + cyl,
interaction = ~drat * cyl,
full = add_predictors(interaction, ~am, ~vs)
))
# The list of fitted models is named after the names of the list of
# formulas:
disp_fits$full
# Additional arguments are passed on to .f
mtcars %>% fit_with(glm, list(am ~ disp), family = binomial)
``` |

modelr documentation built on July 25, 2017, 1:01 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.