tidypredict_fit
It parses a model or uses an already parsed model to return a Tidy Eval formula that can then be used inside a dplyr command.
tidypredict_fit(model)
Arguments
model | An R model or a tibble with a parsed model. It currently supports lm(), glm() and randomForest() models. |
Examples
library(dplyr)
df <- mutate(mtcars, cyl = paste0("cyl", cyl))
model <- lm(mpg ~ wt + cyl * disp, offset = am, data = df)
tidypredict_fit(model)#> (((((((39.4127792009634) + ((wt) * (-1.61917264901457))) + ((ifelse((cyl) ==
#> ("cyl6"), 1, 0)) * (-18.4170134479827))) + ((ifelse((cyl) ==
#> ("cyl8"), 1, 0)) * (-16.2066476965851))) + ((disp) * (-0.0929785674850189))) +
#> (((disp) * (ifelse((cyl) == ("cyl6"), 1, 0))) * (0.11133890642722))) +
#> (((disp) * (ifelse((cyl) == ("cyl8"), 1, 0))) * (0.0879557120382374))) +
#> (am)