title: simple visualization of GAM model in R
body: <p>I am using this:</p>
  
  <pre><code>library(datasets)
  library(ggplot2)
  
  model &lt;- gam(
      Petal.Width ~
  
      s(Sepal.Length)
  
      , data = iris
      , method = "REML"
  )
  
  ggplot(iris, aes(x = Petal.Width, y = Sepal.Length)) +
  geom_point() +
  geom_smooth(method = "gam", formula = Petal.Width ~ s(Sepal.Length))
  </code></pre>
  
  <p>but get this error:</p>
  
  <pre><code>Warning message:
  Computation failed in `stat_smooth()`:
  object 'Petal.Width' not found 
  </code></pre>
  
  <p>any ideas? Thanks!</p>