title: How do I classify this data by year and region in R?
body: <p>So I have the following data:</p>
  
  <p><a href="https://i.stack.imgur.com/IBmkP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IBmkP.png" alt="image"></a></p>
  
  <p>I have 5 regions, and years 1998-2009. What I like to do is to classify countries each year by regions. I'm new at R so the only step I've taken so far is the following: </p>
  
  <pre><code>finalData$Region = factor(finalData$Region, levels = c('Former Socialist Bloc', 'Independent', 'Western Europe','Scandinavia', 'Former Yugoslavia'), levels = c(1, 2, 3, 4, 5))
  </code></pre>
  
  <p>but I get this error:</p>
  
  <blockquote>
    <p>Error in factor(finalData$Region, levels = c("Former Socialist Bloc", 
    :    formal argument "levels" matched by multiple actual arguments</p>
  </blockquote>
  
  <p>Could please tell me how to fix this and an approach to how to do the classification? Thank you!</p>