title: How do I make a Faceted Scatterplot in R?
body: <p>I'm quite new to R and I've been working at this problem for some time and could use some help. I have a CSV file (called cleaned_doc) which contains the rating and percent of a product sold per country, I would like to compare 2 countries in a faceted scatterplot with 2 facets for all of the product sold in those particular countries of origin. </p>
  
  <p>When I try doing it like this </p>
  
  <pre><code>ggplot(data = cleaned_doc, aes(Percent, Rating)) +
    geom_point() +
    labs( y = "Rating", x = "Percent") + 
    facet_grid( ~ Origin ) 
  </code></pre>
  
  <p>I get faceted scatter plots for all the countries listed. However I just want to compare 2 (for this example I picked Germany and France) there are more components I want to add later but those are mainly aesthetics so I just want to keep it simple for now. Based on what I've seen on Stackoverflow &amp; other places I tried doing it like this </p>
  
  <pre><code>countries &lt;- gather(cleaned_doc, key="measure", value="value", c(Origin["Germany"], Origin["France"]))
  
  answer2 &lt;- ggplot(data = cleaned_doc, aes(Percent, Rating)) +
    geom_point() +
    labs( y = "Rating", x = "Percent") + 
    facet_grid(~ countries )
  </code></pre>
  
  <p>However then I get the following error </p>
  
  <pre><code>Error: At least one layer must contain all faceting variables: `countries`.
  * Plot is missing `countries`
  * Layer 1 is missing `countries`
  </code></pre>
  
  <p>and I'm really not sure what that means and what I'm doing wrong.  so I would really appreciate any help. </p>