title: how to select specific row by a column
body: <p>I have a data, as an example I show below </p>
  
  <pre><code>a = rep(1:5, each=3)
  b = rep(c("a","b","c","a","c"), each = 3)
  df = data.frame(a,b)
  </code></pre>
  
  <p>I want to select all the rows that have the "a"</p>
  
  <p>I tried to do it with </p>
  
  <pre><code>df[df$a %in% a,]
  </code></pre>
  
  <p>Can someone give me an idea how to get them out? </p>
  
  <pre><code>df2&lt;- structure(list(V1 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
  1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), V2 = structure(c(1L, 
  2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 
  5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L), .Label = c("B02", "B03", 
  "B04", "B05", "B06", "B07", "C02", "C03", "C04", "C05", "C06", 
  "C07"), class = "factor")), .Names = c("V1", "V2"), class = "data.frame", row.names = c(NA, 
  -24L))
  </code></pre>
  
  <p>I want to select specific rows that start with B but not all of them and just 02, 03, 04, 05</p>
  
  <pre><code>1   B02
  1   B03
  1   B04
  1   B05
  2   B02
  2   B03
  2   B04
  2   B05
  </code></pre>
  
  <p>I also want to have the original data without them too </p>