I have the following problem: I have a data frame where the values of different variables of one observation are spread over multiple rows, like this:
| Id | Var1 | Var2 |
|---|---|---|
| A | 0.2 | NA |
| A | NA | 0.3 |
| B | 0.4 | NA |
| B | NA | 0.5 |
I tried to convert it in a way, that each observation is in one row:
| Var1 | Var2 | |
|---|---|---|
| A | 0.2 | 0.3 |
| B | 0.4 | 0.5 |
But I could´nt come up with a solution... I would very much appreciate it if someone has some ideas on how to solve that.