I have data in the following format and am trying to create a new variable that includes the total number of deaths for each observation, where "present" indicates an ongoing event:

```
    Birth1  Death1  Birth2  Death2  Birth3  Death3  Birth4  Death4  Birth5  Death5  Birth6  Death6
  1 1990    present                                     
  2 1984    1986    1986    present                             
  3 1985    1988    1988    present                             
  4 1987    1991    1991    1994    1996    present                     
  5 1987    1989    1989    present                             

```

I tried `data$num.deaths <- ifelse(data$death1=="present", 0, 1)` but obviously that doesn't get at the observations that have more than one death event. I also tried nested ifelse but got the same result. Can anybody point me to a fast and efficient way of doing this?