title: R: how to filter out rows that end with a specific list characters?
body: <p>I have a data frame that looks like this:</p>
  <pre><code>+-----------------+--------+
  | Geography       | Values |
  +-----------------+--------+
  | Atlanta, GA     | 78     |
  +-----------------+--------+
  | New York, NY    | 30     |
  +-----------------+--------+
  | Denver, CO      | 20     |
  +-----------------+--------+
  | Omaha, NE       | 178    |
  +-----------------+--------+
  | Los Angeles, CA | 58     |
  +-----------------+--------+
  | Providence, RI  | 100    |
  +-----------------+--------+
  | Little Rock, AR | 20     |
  +-----------------+--------+
  | Miami, FL       | 50     |
  +-----------------+--------+
  | ...             |        |
  +-----------------+--------+
  </code></pre>
  <p>I would look to perform an operation in tidyverse/dplyr format so that I can <strong>filter out any rows that is from the state of GA &amp; CA</strong>. Notice that there is always a &quot;, &quot; (a comma, followed by a space) before the state abbreviation.</p>
  <p>The resulting dataframe should look like:</p>
  <pre><code>+-----------------+--------+
  | Geography       | Values |
  +-----------------+--------+
  | New York, NY    | 30     |
  +-----------------+--------+
  | Denver, CO      | 20     |
  +-----------------+--------+
  | Omaha, NE       | 178    |
  +-----------------+--------+
  | Providence, RI  | 100    |
  +-----------------+--------+
  | Little Rock, AR | 20     |
  +-----------------+--------+
  | Miami, FL       | 50     |
  +-----------------+--------+
  | ...             |        |
  +-----------------+--------+
  </code></pre>
  <p>The real data is much larger than this simple example. It is consists of hundreds of cities with multiple cities in a state, so I can not simply do something like:</p>
  <pre><code>data %&gt;%
  filter (Geography == &quot;Atlanta, GA&quot; | Geography == &quot;Los Angeles, CA&quot;)
  </code></pre>
  <p>Should I create a new &quot;State&quot; column that takes out the last 2 letters of the &quot;Geography&quot; column, and filter on that &quot;State&quot; column, or can I do something regex related such as:</p>
  <pre><code>exclude_list = c(&quot;GA, CA&quot;)
  
  data %&gt;%
  filter (Geography != end_with(exclude_list))
  </code></pre>
  <p>What is an elegant way to do this? Thanks so much for your help!</p>