title: How to remove unmatched data from two data frames, to create a new data frame in R
body: <p>I am creating a graph that correlates the life expectancy age and the state pension age for each country. I have used web scraping packages to scrape 2 datasets from 2 Wikipedia pages.</p>
  
  <p>One of the datasets contains the column "Country" and the other dataset contains the column "Country and regions". This is a problem because both datasets need to merge but are unbalanced due to the regions in the "Country and regions" column.</p>
  
  <p>To solve this, I need to remove the regions in "Country and regions", before merging the datasets, so it is balanced. I need to find the unmatched data from "Country and regions" with "Country", remove it, and create one data frame with the 2 datasets.</p>
  
  <pre><code>library(xml2)
  library(rvest)
  library(stringr)
  
  urlLifeExpectancy &lt;- "https://en.wikipedia.org/wiki/List_of_countries_by_life_expectancy"
  
  extractedLifeData = urlLifeExpectancy %&gt;%
    read_html() %&gt;%
    html_node(xpath = '//*[@id="mw-content-text"]/div/table[1]') %&gt;%
    html_table(fill = TRUE)
  
  urlPensionAge &lt;- "https://en.wikipedia.org/wiki/Retirement_age#Retirement_age_by_country"
  
  extractedPensionData = urlPensionAge %&gt;%
    read_html() %&gt;%
    html_node(xpath = '//*[@id="mw-content-text"]/div/table[3]') %&gt;%
    html_table(fill = TRUE)
  </code></pre>