title: Geom_smooth line not showing up or not appearing on the graph in r
body: <p>I am trying to graph a trend line to this graph(attached bellow). I have created a new dataframe (bothyearsdf) by combining two dataframes (df_year1 and df_year2). They had the same column names but different row values. I changed the class of the first column from &quot;character&quot; to &quot;date&quot; since it displays all the days in year 2019 and year 2020 (%y/%m/%d). I left the other column as it originally was, which was numeric.</p>
  <pre><code>      class(bothyearsdf$Data.first_max_value) #&quot;numeric&quot;
        class(bothyearsdf$Data.date_local) #&quot;character&quot;
        bothyearsdf$Data.date_local &lt;- as.Date(df_year2$Data.date_local, 
        format='%y/%m/%d')
        class(bothyearsdf$Data.date_local)&quot;date&quot;
  </code></pre>
  <p>Then, I tried to use geom_smooth by itself- geom_smooth() -to create the line but it was giving me an error at first, &quot;Error in FUN(X[[i]], ...) : object 'Data.date_local' not found.&quot; Then, I used the code bellow and it stopped giving me an error but it does not make a trend line on the plot. It also says &quot;geom_smooth()` using method = 'loess' and formula 'y ~ x'&quot;</p>
  <p>Thank you in advance!!</p>
  <p><a href="https://i.stack.imgur.com/7A9Is.png" rel="nofollow noreferrer">picture of the graph</a></p>
  <pre><code>    w &lt;- ggplot(NULL, aes(x=Data.date_local,y=Data.first_max_value)) +
           geom_point(data = bothyearsdf) + 
           geom_smooth(data = bothyearsdf, aes(x = Data.date_local,y = 
           Data.first_max_value, 
           color = 'red')) +
           labs(x = &quot;Days&quot;, y = &quot;PM2.5 Max Value&quot;, title = &quot;Wake County, NC Max PM2.5 
           Value for 2019 and 2020&quot;)
  
       w
  </code></pre>
  <p>'''</p>