Skip to content

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

Closed

Description

@taqtiqa-mark

Thank you for all your efforts in making these libraries available. Much appreciated!
I believe I have found a minimal(ish) reproducible example of an issue I am also encountering.

library(tidyverse)
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)
#> Error in eval_tidy(xs[[i]], unique_output): object 'G' not found

Created on 2018-05-10 by the reprex package (v0.2.0).

Activity

  1. pkq commented on Oct 17, 2017

    @pkq
  2. fenghaolin commented on Nov 20, 2017

    @fenghaolin
  3. hughchipman commented on Nov 22, 2017

    @hughchipman

    FWIW, a specific fix to the R for Data Science book is to replace

    grid <- diamonds2 %>%
    data_grid(cut, .model = mod_diamond2) %>%
    add_predictions(mod_diamond2)

    with this:

    grid <- diamonds2 %>%
    data_grid(cut, lcarat = -0.515, color = "G", clarity = "SI1") %>%
    add_predictions(mod_diamond2)

    Basically explicitly specifying the levels of all factors that are not to be gridded.

  4. subaiwen commented on Mar 30, 2018

    @subaiwen
  5. hadley commented on May 10, 2018

    @hadley
    Member

    Minimal reprex:

    library(modelr)
    
    df <- tibble::tibble(x = rep(c("a", "b"), each = 5), y = rep(c("a", "b"), 5), z = rnorm(10))
    mod <- lm(z ~ x + y, data = df)
    data_grid(df, .model = mod)
    #> Error in eval_tidy(xs[[i]], unique_output): object 'a' not found

    Created on 2018-05-10 by the reprex package (v0.2.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions