title: dplyr + ggplot2: Plotting not working via piping
body: <p>I want to plot a subset of my dataframe. I am working with dplyr and ggplot2. My code only works with version 1, not version 2 via piping. What's the difference? </p>
  
  <p>Version 1 (plotting is working):</p>
  
  <pre><code>data &lt;- dataset %&gt;% filter(type=="type1")
  ggplot(data, aes(x=year, y=variable)) + geom_line()
  </code></pre>
  
  <p>Version 2 with piping (plotting is not working): </p>
  
  <pre><code>data %&gt;% filter(type=="type1") %&gt;% ggplot(data, aes(x=year, y=variable)) + geom_line()
  </code></pre>
  
  <p>Error: </p>
  
  <pre><code>Error in ggplot.data.frame(., data, aes(x = year,  : 
  Mapping should be created with aes or aes_string
  </code></pre>
  
  <p>Thanks for your help!</p>