I would like to count the first occurrences of two variables (IPC and 2IPC) in R, leaving out cases in which the two variables are the same (e.g. !IPC == 2IPC).
Here is an example of dataset:
**date IPC 2IPC occurrence**
1968 G01S Na 1
1969 G01N G01S 1
1969 B62D B43L 1
1969 G01S Na 0
1970 G01S G01C 1
1970 G01S H04B 1
1970 G01S H04B 0
1971 G01S H01S 1
1971 G01S G01S 0
1972 H04N H04N 0
1972 G01S G01S 0
1972 G01S G01S 0
I used the Excel function COUNTIFS which create a dummy (occurrence) for the first occurrences between two variables. Is it possible to use dplyr for this task?