title: R, create a dummy for each observation that matches a vector
body: <p>The following is a simple example of what I am trying to do. I have a data frame which includes states as a variable. I want to create a new column that indicates whether or not its a coastal state and I have a vector of coastal states already made. </p>
  
  <pre><code>states&lt;- c("AZ", "TN", "MI", "NY", "CA", "FL", "MA", "OH")
  numbers&lt;- c(1:8)
  df&lt;- data.frame(states, numbers)
  coastal &lt;- c("NY", "CA", "FL", "MA")
  
  </code></pre>