3
Suppose there is a basis with two variables as follows:
Município   IF
RIOBOM  Cooperativa
RIOBOM  Cooperativa
ABADIA  Múltiplo
ABADIA  Múltiplo
ABADIA  Cooperativa
ABADIA  Banco
DOURADOS    Banco
DOURADOS    Múltiplo
DOURADOS    Banco
DOURADOS    Cooperativa
DOURADOS    Múltiplo
To create an indicator that marks only those municipalities that have only "cooperative", independent of having "cooperative" and "bank" or "multiple", it is necessary to have only "cooperative" in the IF variable. Resulting in the following basis:
Município   IF  Indicador
RIOBOM  Cooperativa 1
RIOBOM  Cooperativa 1    
ABADIA  Múltiplo    0
ABADIA  Múltiplo    0
ABADIA  Cooperativa 0
ABADIA  Banco   0
DOURADOS    Banco   0
DOURADOS    Múltiplo    0
DOURADOS    Banco   0
DOURADOS    Cooperativa 0
DOURADOS    Múltiplo    0
I believe the dplyr package works in such a case.
That’s exactly what it was!
– T. Veiga