Hello, I'm new to R and I'm getting caught up in solving this problem. I have a spreadsheet I called base
and it has 2573 observations of 103 variables.
I've created an auxiliary column named reclamacoes.titulo
. I need to check where 1 is on each row and return, in the reclamacoes.titulo
column, or the corresponding column name or its index.
I was able to write a code that returns the indexes of the lines where each one is. For example, the indexes of the rows that have 1 in the periculosidade
column is:
> dic.busca.indice.periculosidade
[1] 81 84 85 91 92 516 575 576 577 578 579 636 637 638 639 640 641 643 742 743 744 745 746 747 969
[26] 970 971 972 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1411 1412 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424
[51] 1425 1426 1531 1532 1533 1534 1535 1694 1695 1979
In this case, my column reclamacoes.titulo
was supposed to look like this:
Justiça Gratuita
Justiça Gratuita
Perdas e Danos
Perdas e Danos
Perdas e Danos
Perdas e Danos
Perdas e Danos
Prescrição
Perdas e Danos
Justiça Gratuita
Perdas e Danos