Hi,
I have the following situation:
I have a data frame with several columns, a group of them I want to turn into key value. So far so good, but there are 2 groups and they can not kinda repeat themselves. Type, is a group of 3 and another of 3
NOME A1 A2 A3 B1 B2 B3
batata 6 4 7 2 1 1
maçã 9 4 8 1 2 0
I made the gather 2 times, one for A1 A2 A3 and one for B1 B2 B3. The problem is that the resulting line number is 2 * 3 * 3 = 18, as it takes a result of A and makes a line for each result of B
NOME keyA valueA keyB valueB
batata A1 6 B1 2
batata A1 6 B2 1
batata A1 6 B3 1
maçã A1 9 B1 2
maçã A1 9 B2 1
maçã A1 9 B3 1
.......... (same process with A2 and A3)
What I need is for each value of A1, I have only the key B1, of A2 only B2, etc. So:
NOME keyA valueA keyB valueB
batata A1 6 B1 2
batata A2 4 B2 1
batata A3 7 B3 1
maçã A1 9 B1 1
maçã A2 4 B2 2
maçã A3 8 B3 0
Only 6 lines
Can anyone help me? XD