title: Creating a scatter plot using two data sets in R
body: <p>Beginner here. I'm hoping to create a scatterplot using two datasets that I created using group by: </p>
  
  <pre><code>menthlth_perc_bystate &lt;- brfss2013 %&gt;% 
    group_by(state) %&gt;%
    summarise(percent_instability = sum(menthlth &gt; 15, na.rm = TRUE) / n()) %&gt;%
    arrange(desc(percent_instability))
  
  exercise_perc_bystate &lt;- brfss2013 %&gt;%
    group_by(state) %&gt;%
    summarise(perc_exercise = sum(exeroft1 &gt; 30, na.rm = TRUE) / n()) %&gt;%
    arrange(desc(perc_exercise))
  </code></pre>
  
  <p>I want to merge these into one dataset, total_data. Both have 54 obs. </p>
  
  <pre><code>total_data &lt;- merge(menthlth_perc_bystate,exercise_perc_bystate,by="state")
  </code></pre>
  
  <p>Presumably the scatter plot would take on one axis the state's percent instability (menthlth_perc_bystate) and on another the states percent exercise (exercise_perc_by_state). I tried this using ggplot but got an error: </p>
  
  <p><code>ggplot(total_data, aes(x = total_data$menthlth_perc_bystate, y = total_data$exercise_perc_bystate)) + geom_point()</code></p>
  
  <p>The error: Aesthetics must be either length 1 or the same as the data (54): x, y</p>