I have a web scraping data frame with different elements from some documents. I need to aggregate by the frist column, cause it identifies the document. Other columns are the kinds of elements from the text, with a lot of NA values. I want aggregate to make a row for each document with all elements. I've this:
| DocID | ElementA | ElementB |
|---|---|---|
| 1 | A1 | NA |
| 1 | NA | B1 |
| 2 | A2 | NA |
| 2 | NA | B2 |
| 3 | A3 | NA |
| 3 | NA | B3 |
And I want to get:
| DocID | ElementA | ElementB |
|---|---|---|
| 1 | A1 | B1 |
| 2 | A2 | B2 |
| 3 | A3 | B3 |