I have a data frame by 20441 rows and 158 columns. in each row, there are a lot of "NA" values. so I want to convert it to sth like this:
If a value is not NA, I save it's row name , column name and value in another data frame. for example my first data frame is :
| row and column name | c1 | c2 | c3 | c4 | c5 |
|---|---|---|---|---|---|
| r1 | NA | NA | NA | 5 | 6 |
| r2 | 1 | 3 | NA | NA | NA |
| row name | c1 | c2 |
|---|---|---|
| r1 | c4 | 5 |
| r1 | c5 | 6 |
| r2 | c1 | 1 |
| r2 | c2 | 3 |