R tidyverse - data_grid .model parameter

808 views Asked by At

following an update of my R environment, I keep receiving this error:

Error in overscope_eval_next(overscope, expr) : object 'G' not found

Documentation says: "A model. If supplied, any predictors needed for the model not present in ... will be filled in with "typical" values."

This seems to work for the given example in the documentation. However, there seems to be a problem with the given example below. There was no problem with previous versions.

library(tidyverse)
library(hexbin)
library(modelr)
smaller <- diamonds %>% filter(carat < 3)
mod_diamond2 <- lm(price ~ carat + color + cut + clarity, data = smaller)
grid <- smaller %>%  data_grid(cut, .model = mod_diamond2) %>% 
add_predictions(mod_diamond2)

Any ideas? Thanks in advance

0

There are 0 answers