My DF has two dummy columns:
| Invested | ProgramParticipant |
|---|---|
| 1 | 0 |
| 0 | 0 |
| 1 | 1 |
| 1 | 0 |
| 0 | 1 |
| 0 | 0 |
The goal is to create a third dummy column, which only considers the rows that did not invest, and assigns a 1 if they participated in the program. If the row did not invest, a NA should be assigned. Ideally, it would look like this:
| Invested | ProgramParticipant | Invested&Participated |
|---|---|---|
| 1 | 0 | 0 |
| 0 | 0 | NA |
| 1 | 1 | 1 |
| 1 | 0 | 0 |
| 0 | 1 | NA |
| 0 | 0 | NA |
I tried working with standard ifelse statements, or with DPLYR's casewhen, but I cannot seem to fix the NA assignments.