I have a list that each element is a data frame
containing various information about a particular pension provider. In the CLASSE
column there can only be one type and I need to know who has more than one type. How to create a column that returns TRUE if INSTITUIDOR
has pensioners of different classes.
Below dput
of head
of list:
structure(list('1002538-1' = structure(list(ID.VINC.INST = c("1002538-1",
"1002538-1"), DS_PREFIXO = c("FILHO (A) INVÁLIDO (A)", "VIÚVA"
), ID.FUNCIONAL = c(43189938L, 43189920L), NR_MATRICULA = c("0094712B",
"0094712A"), NOME = c("RAQUEL ELCO CAMPOS", "CELINA ELCO CAMPOS"
), ID_FUNCIONAL_INSTITUIDOR = c(1002538L, 1002538L), VINCULO_INSTITUIDOR = c(1L,
1L), NUMPENS = c(2L, 1L), NM_INSTITUIDOR = c("JOCELINO VILLELA CAMPOS",
"JOCELINO VILLELA CAMPOS"), VL_BRUTO = c(1182.13, 1182.13), MES_REF = c("01/08/2017",
"01/08/2017"), CLASSE = c("CLASSE 1", "CLASSE 1"), Freq = c(2L,
2L)), .Names = c("ID.VINC.INST", "DS_PREFIXO", "ID.FUNCIONAL",
"NR_MATRICULA", "NOME", "ID_FUNCIONAL_INSTITUIDOR", "VINCULO_INSTITUIDOR",
"NUMPENS", "NM_INSTITUIDOR", "VL_BRUTO", "MES_REF", "CLASSE",
"Freq"), row.names = 5:6, class = "data.frame"), '1003437-1' = structure(list(
ID.VINC.INST = c("1003437-1", "1003437-1"), DS_PREFIXO = c("VIÚVA",
"DEPENDENTE"), ID.FUNCIONAL = c(44227795L, 44235089L), NR_MATRICULA = c("0416908A",
"0416908B"), NOME = c("VERGINIA MARIA DE OLIVEIRA ROSA",
"EMILLY DE OLIVEIRA ROSA"), ID_FUNCIONAL_INSTITUIDOR = c(1003437L,
1003437L), VINCULO_INSTITUIDOR = c(1L, 1L), NUMPENS = 1:2,
NM_INSTITUIDOR = c("ANTONIO PLACIDIO LOPES ROSA", "ANTONIO PLACIDIO LOPES ROSA"
), VL_BRUTO = c(3047.47, 3047.47), MES_REF = c("01/08/2017",
"01/08/2017"), CLASSE = c("CLASSE 1", "OUTRAS"), Freq = c(2L,
2L)), .Names = c("ID.VINC.INST", "DS_PREFIXO", "ID.FUNCIONAL",
"NR_MATRICULA", "NOME", "ID_FUNCIONAL_INSTITUIDOR", "VINCULO_INSTITUIDOR",
"NUMPENS", "NM_INSTITUIDOR", "VL_BRUTO", "MES_REF", "CLASSE",
"Freq"), row.names = 10:11, class = "data.frame"), '10087958-1' = structure(list(
ID.VINC.INST = c("10087958-1", "10087958-1"), DS_PREFIXO = c("VIÚVA",
"FILHO (A) MENOR"), ID.FUNCIONAL = c(50740172L, 50740202L
), NR_MATRICULA = c("", ""), NOME = c("ALEXANDRA GOMES DE OLIVEIRA MACIEL",
"JUAN PEDRO DE OLIVEIRA MACIEL"), ID_FUNCIONAL_INSTITUIDOR = c(10087958L,
10087958L), VINCULO_INSTITUIDOR = c(1L, 1L), NUMPENS = 1:2,
NM_INSTITUIDOR = c("MARCO ANTONIO DE OLIVEIRA MACIEL", "MARCO ANTONIO DE OLIVEIRA MACIEL"
), VL_BRUTO = c(3076.8, 3076.8), MES_REF = c("01/08/2017",
"01/08/2017"), CLASSE = c("CLASSE 1", "CLASSE 1"), Freq = c(2L,
2L)), .Names = c("ID.VINC.INST", "DS_PREFIXO", "ID.FUNCIONAL",
"NR_MATRICULA", "NOME", "ID_FUNCIONAL_INSTITUIDOR", "VINCULO_INSTITUIDOR",
"NUMPENS", "NM_INSTITUIDOR", "VL_BRUTO", "MES_REF", "CLASSE",
"Freq"), row.names = 19:20, class = "data.frame"), '10114963-1' = structure(list(
ID.VINC.INST = c("10114963-1", "10114963-1"), DS_PREFIXO = c("FILHO (A) MENOR",
"VIÚVA"), ID.FUNCIONAL = c(50853104L, 50853090L), NR_MATRICULA = c("",
""), NOME = c("GUILHERME DE ASSIS MARINHO", "ELISANGELA DE ASSIS SILVA MARINHO"
), ID_FUNCIONAL_INSTITUIDOR = c(10114963L, 10114963L), VINCULO_INSTITUIDOR = c(1L,
1L), NUMPENS = c(2L, 1L), NM_INSTITUIDOR = c("EDSON BORBA MARINHO",
"EDSON BORBA MARINHO"), VL_BRUTO = c(3095.41, 3095.41), MES_REF = c("01/08/2017",
"01/08/2017"), CLASSE = c("CLASSE 1", "CLASSE 1"), Freq = c(2L,
2L)), .Names = c("ID.VINC.INST", "DS_PREFIXO", "ID.FUNCIONAL",
"NR_MATRICULA", "NOME", "ID_FUNCIONAL_INSTITUIDOR", "VINCULO_INSTITUIDOR",
"NUMPENS", "NM_INSTITUIDOR", "VL_BRUTO", "MES_REF", "CLASSE",
"Freq"), row.names = 27:28, class = "data.frame"), '10179151-1' = structure(list(
ID.VINC.INST = c("10179151-1", "10179151-1", "10179151-1"
), DS_PREFIXO = c("FILHO (A) MENOR", "COMPANHEIRA", "FILHO (A) MENOR"
), ID.FUNCIONAL = c(43038824L, 43300464L, 43038816L), NR_MATRICULA = c("0410258B",
"0410258C", "0410258A"), NOME = c("ERICA FERREIRA ROGERIO DE SOUZA",
"PATRICIA FERREIRA DA SILVA", "ERIC ROGERIO DE SOUZA JUNIOR"
), ID_FUNCIONAL_INSTITUIDOR = c(10179151L, 10179151L, 10179151L
), VINCULO_INSTITUIDOR = c(1L, 1L, 1L), NUMPENS = c(2L, 3L,
1L), NM_INSTITUIDOR = c("ERIC ROGERIO DE SOUZA", "ERIC ROGERIO DE SOUZA",
"ERIC ROGERIO DE SOUZA"), VL_BRUTO = c(416.04, 832.09, 416.04
), MES_REF = c("01/08/2017", "01/08/2017", "01/08/2017"),
CLASSE = c("CLASSE 1", "CLASSE 1", "CLASSE 1"), Freq = c(3L,
3L, 3L)), .Names = c("ID.VINC.INST", "DS_PREFIXO", "ID.FUNCIONAL",
"NR_MATRICULA", "NOME", "ID_FUNCIONAL_INSTITUIDOR", "VINCULO_INSTITUIDOR",
"NUMPENS", "NM_INSTITUIDOR", "VL_BRUTO", "MES_REF", "CLASSE",
"Freq"), row.names = 40:42, class = "data.frame"), '1031945-1' = structure(list(
ID.VINC.INST = c("1031945-1", "1031945-1"), DS_PREFIXO = c("FILHO (A) MENOR",
"FILHO (A) MENOR"), ID.FUNCIONAL = c(50840835L, 50840827L
), NR_MATRICULA = c("", ""), NOME = c("LUIZ SERGIO RAMOS TORRES",
"JULIANA RAMOS TORRES"), ID_FUNCIONAL_INSTITUIDOR = c(1031945L,
1031945L), VINCULO_INSTITUIDOR = c(1L, 1L), NUMPENS = c(2L,
1L), NM_INSTITUIDOR = c("ETEVALDO CORREA TORRES", "ETEVALDO CORREA TORRES"
), VL_BRUTO = c(656.83, 656.83), MES_REF = c("01/08/2017",
"01/08/2017"), CLASSE = c("CLASSE 1", "CLASSE 1"), Freq = c(2L,
2L)), .Names = c("ID.VINC.INST", "DS_PREFIXO", "ID.FUNCIONAL",
"NR_MATRICULA", "NOME", "ID_FUNCIONAL_INSTITUIDOR", "VINCULO_INSTITUIDOR",
"NUMPENS", "NM_INSTITUIDOR", "VL_BRUTO", "MES_REF", "CLASSE",
"Freq"), row.names = 86:87, class = "data.frame")), .Names = c("1002538-1",
"1003437-1", "10087958-1", "10114963-1", "10179151-1", "1031945-1"
))