title: Adding USL/LSL reference lines where some variables have NA for these : as Error: Discrete value supplied to continuous scale
body: <p>I am getting this error for the following code segment and I believe it's because of the reference lines I am trying to add with the &quot;geom_hline...&quot; lines - when I comment those out, the code runs fine. And I think those reference lines are giving the issue because, depending on the value of &quot;test_par[j]' (namely for some of my test parameter variables), usl and/or lsl could be NA (some of the variables have only min or max spec limit). Is there a way to get around this so that I can have the code print the reference lines as they apply to a given variable rather than have to write a different segment of code for each variable (which will be quite tedious and long)?</p>
  <pre><code>  dw_trend3 &lt;- all_data2 %&gt;%
          ggplot(aes(x=week, y=test_par_avg))+
          geom_point()+
          geom_smooth(method=lm)+
          scale_x_continuous(expand=c(0,0))+
          geom_hline(yintercept = lsl, linetype= &quot;dashed&quot;, color=&quot;red&quot;)+
          geom_hline(yintercept = usl, linetype= &quot;dashed&quot;, color=&quot;red&quot;)+
          geom_hline(yintercept =target, linetype= &quot;dashed&quot;, color=&quot;green&quot;)+
          labs(title=paste(test_par[j], &quot;Trend_Plant:&quot;, plant[i],&quot;Last:&quot;,test_months[k],&quot;months&quot; ), x=&quot;Weeks since 1/1/2020&quot;, y=paste(test_par[j]))
  </code></pre>