title: How to add a curved fit lines to points for multiple variable data?
body: <p>I am trying to graph expected values and actual values, over time. I have some data that I'd like to get all on one graph. I am still pretty new to <code>R</code>, I keep getting stuck. </p>
  
  <p>So far I have been able to get what I want on separate graphs, or if I get them all together, I can't seem to get it to do what I want. </p>
  
  <p>I am almost there, but I'd like to have the points (points are expected values) connected with a dashed line. I tried adding a <code>LOESS</code> line a few different ways (one is hashed in my code), but I keep getting errors. </p>
  
  <p>I am still new to <code>R</code> (and coding in general), but I know there has to be a way to do this besides building up the plot manually. However, every example I try will do <em>something</em> that I want, but I can't seem to get everything to work at once.  I am starting to understand what each thing does, but sometimes I get lost in what works with what.  </p>
  
  <blockquote>
    <p>Error in xy.coords(x, y, xlabel, ylabel) :    'x' is a list, but does
    not have components 'x' and 'y'</p>
    
    <p>Error: Don't know how to add RHS to a theme object</p>
  </blockquote>
  
  <p><strong>My plot:</strong> (without links connected)</p>
  
  <p><a href="https://i.stack.imgur.com/0ifZN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0ifZN.png" alt="My plot, without links connected"></a></p>
  
  <p><strong>My Dataset</strong></p>
  
  <pre><code>Year,SC_CE_5AGG,SC_ACA,TA_CE_5AGG,TA_ACA,OA_CE_5AGG,OA_ACA,CO_CE_5AGG,CO_ACA
  2005,8,12,5,0,140,100,23,23
  2006,,13,,0,,100,,25
  2007,,13,,0,,102,,37
  2008,,14,,0,,104,,36
  2009,,16,,3,,104,,35
  2010,10,17,6,4,179,106,29,36
  2011,,20,,7,,111,,36
  2012,,23,,7,,116,,33
  2013,,22,,10,,118,,37
  2014,,23,,12,,107,,40
  2015,12,23,8,14,229,112,37,46
  2016,,25,,14,,119,,56
  2017,,28,,13,,120,,60
  2018,,,,,,,,
  2019,,,,,,,,
  2020,16,,10,,292,,48,
  2025,20,,20,,372,,61,
  </code></pre>
  
  <p><strong>My code</strong></p>
  
  <pre><code>setwd("C:Users/X/Documents/PROJECTS/R_RcW/Data")
  
  
  install.packages("ggplot2")
  install.packages("GGally")
  library(ggplot2)
  library(GGally)
  
  ALL &lt;- read.csv(file="Rcw_data.csv", header = TRUE)
  
  #To plot multiple lines, (for a small number of variables) you can use build up the plot manually yourself
  ggplot(data=ALL, aes(Year)) + 
     geom_line(aes(y = SC_ACA, colour = "Shoal Creek")) + 
     lines(scatter.smooth(aes(y = SC_CE_5AGG, colour = "Shoal Creek"))) + 
     geom_line(aes(y = TA_ACA, colour = "Talladega")) +
     lines(scatter.smooth(aes(y = TA_CE_5AGG, colour = "Talladega"))) +
     geom_line(aes(y = OA_ACA, colour = "Oakmulgee")) + 
     lines(scatter.smooth(aes(y = OA_CE_5AGG, colour = "Oakmulgee"))) + 
     geom_line(aes(y = CO_ACA, colour = "Conecuh")) +
     lines(scatter.smooth(aes(y = CO_CE_5AGG, colour = "Conecuh"))) +
    #lines(lowess(SC_CE_5AGG), col="Shoal Creek") +  # lowess line (x,y) 
    #lines(lowess(TA_CE_5AGG), col="Talladega") +  # lowess line (x,y)
    #lines(lowess(OA_CE_5AGG), col="Oakmulgee") + # lowess line (x,y)
    #lines(lowess(CO_CE_5AGG), col="Conecuh") # lowess line (x,y)
  
    theme_classic() +
    ggtitle("Active clusters of Red-cockaded Woodpeckers") +  
    theme(plot.title = element_text(hjust = 0.5)) +
    labs(colour="District") + 
    theme(legend.title.align=0.5) +
    theme(panel.border = element_rect(colour = "black", fill=NA, size=)) +
    scale_x_continuous(limits=c(2005, 2025), breaks=c(2005,2010,2015,2020,2025)) +
    xlab("Year") + ylab("Number of active clusters")   
  </code></pre>