Caused by error in `FUN()`; Error in `geom_smooth()`:


Can someone please help me fix the issue "Caused by an error in `FUN()" ? Reading the error messages, but I don't find the mistake that occurred with my code though.
Here is the error message:

Error in geom_smooth():
! Problem while computing aesthetics.
:information_source: Error occurred in the 1st layer.
Caused by an error in FUN():
! object 'x' not found

Below is what I coded:

ggplot(data = penguins)+

  • geom_smooth(mapping = aes(x=flipper_length_mm,y=body_mass_g))
ggplot(data = penguins) + 
  geom_smooth(mapping = aes(x=flipper_length_mm,y=body_mass_g))

works fine for me.

1 Like

mapping isn't required here

ggplot(data = penguins,aes(flipper_length_mm,body_mass_g)) + geom_smooth()
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'
#> Warning: Removed 2 rows containing non-finite values (stat_smooth).

Created on 2022-12-07 by the reprex package (v2.0.1)

1 Like

Thank you and it is fixed and the problem's solved!!!


Thank you and it is fixed and the problem's solved. mmm They are exactly the same that I coded too. When I copied and pasted your code which is the same as mine, it worked. I wonder why mine was gotton the error..


This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.