title: Data structure issue with plm: multiple observations with the same year-country pair
body: <p>I am trying to run fixed effects and random effects regressions on data which to my understanding is &quot;pseudo&quot; panel data. The dataset consists of rows of syndicated loans with borrower country-level variables attached. The question is how can I apply <code>pdata.frame()</code> to my data when my data has multiple observations (loans) per country-year pair? If I try to use year and country I get the following error:</p>
  <pre><code>Warning in pdata.frame(df, index = c(&quot;borrower_country&quot;, &quot;year&quot;)) :
    duplicate couples (id-time) in resulting pdata.frame
   to find out which, use, e.g., table(index(your_pdataframe), useNA = &quot;ifany&quot;)
  </code></pre>
  <p>I've found some related questions on the topic (<a href="https://stackoverflow.com/questions/61660195/duplicate-couples-id-time-error-in-plm-with-only-two-ids">link</a>), but I don't see how they would apply to my case. Each loan in the data has a unique id number, but if I were to pair that with e.g. year like was suggested in the link, wouldn't that ruin any year fixed/random effects I may want?</p>
  <p>I know that panel data methods have been used in studies with a similar data structure, but I don't understand how to apply the methods to my data.</p>
  <p><a href="https://stats.stackexchange.com/questions/543899/data-structure-issue-with-plm-multiple-observations-with-the-same-year-country?noredirect=1#comment998075_543899">Same question expanded at crossvalidated.</a></p>