automate join columns with tidyverse

Viewed 24

I have had problems programming the following example:

I have an excel with 242 columns and 10 thousand rows

and I want to join, for example, 5 with 82 and 190 with the condition that if the element in the cell is null, the one with the value is put, this should work from cell 5 to cell 32 with its respective 82 and 190

| c1 | c2|c3 |c4 | c5|c6 || c7 | c8|c9 |
| -------|---|---|---|---||----|---|---|
| 4  |NA |NA |NA | 2 | NA||NA  | NA| 1 |
| NA | 3 |2  |NA |NA |NA ||2   | NA|NA |
| NA |NA |NA |NA |NA |NA ||1   | 1 | 3 |
| NA | NA |NA|2  | 2 |3  ||NA  | NA|NA |

Let's say I have a dataframe looks like this

| c1 | c2|c3 |
| ---|---|---|
| 4  |2  |1  |
| 2  |3  |2  |
| 1  |1  |3  |
| 2  |2  |3  |

I tried to concatenate with paste but it didn't work, this process should work for many rows.

0 Answers
Related