title: Regression line just in certain groups (ggplot2)
body: <p>Hi I'm trying to add the regression line just to the Le and Aw groups. Try using subset but didnt work. Dont know what I may be doing wrong.
  Here is my code:</p>
  
  <pre><code># Set up the work directory in which all data is gonna be extracted
  H1517 = read.csv("Test_Subsetv3.csv") #Change name of the file
  # Load the ggplot2 package
  library(ggplot2) #Run to create plots
  library(grid)
  library(cowplot)
  library(gridExtra)
  
  test &lt;- ggplot(H1517,aes(PI,FE,color=factor(Seg)))+
    geom_point()+
    geom_smooth(data=subset(H1517,Seg==Le | 
    Seg==Aw),aes(PI,FE,color=factor(Seg)),method=lm,se=FALSE)
  
  test
  </code></pre>
  
  <p>Then I get the next error:  </p>
  
  <blockquote>
    <p>Error in eval(e, x, parent.frame()) : object 'Le' not found  </p>
  </blockquote>
  
  <pre><code>test  
  </code></pre>
  
  <blockquote>
    <p>Error: object 'test' not found</p>
  </blockquote>
  
  <p><strong>Data in <code>dput</code> format.</strong><br>
  The OP posted this example dataset in a comment.</p>
  
  <pre><code>H1517 &lt;-
  structure(list(FE = c(69.27030884, 60.62345885, 
  59.87889173, 69.27030884, 60.62345885, 59.87889173, 
  69.27030884, 60.62345885, 59.87889173, 71.11906144, 
  69.27030884, 60.62345885, 59.87889173, 61.88615029, 
  71.11906144, 69.27030884, 60.62345885, 59.87889173),
  PI = c(0.203496781, 0.197520353, 0.209443661, 
  0.110640382, 0.116677419, 0.10343242, 0.299820599,
   0.303724997, 0.261057467, 0.125785204, 0.237294948,
   0.249327695, 0.275266774, 0.300414044, 0.283862484,
   0.148747292, 0.13326041, 0.149232038),
   Seg = structure(c(2L, 2L, 2L, 4L, 4L, 4L, 3L, 3L,
   3L, 4L, 1L, 1L, 1L, 3L, 3L, 5L, 5L, 5L),
   .Label = c("Aw", "Glu", "Le", "Pa", "Ra"),
   class = "factor")), row.names = c(NA, 
  -18L), class = "data.frame")
  </code></pre>