I have 3 tables and want to compare then two by two and find which element is missing.
My tables are:
> BaseIda
  Id Quant
1  1     a
2  2     b
3  3     c
4  4     d
5  5     e
6  6     f
7  7     g
> IdaEmpA
  RespA QuantA
1     1     11
2     2     13
3     3     15
4     4      3
5     5     18
6     6      1
7     7      1
> IdaEmpB
  RespB QuantB
1     1     18
2     2     14
3     3     21
4     4      2
5     6     13
6     7      3
I need to compare BaseIda$Id with IdaEmpA$RespA and IdaEmpB$RespB and after that, point which value is missing, considering BaseIda$Id Always have all values. I found the post below usefull but could not manage to make it give my answer: Compare two data.frames to find the rows in data.frame 1 that are not present in data.frame 2
I tried this:
comparacaoA <- compare(BaseIda$Id,IdaEmpA$RespA)
comparacaoB <- compare(BaseIda$Id,IdaEmpA$RespB)
I am not using allowAll=TRUE as I believed it was not necessary by Reading help file.
I am getting this result:
> comparacaoA
TRUE
> comparacaoB
FALSE
Which is correct as IdaEmpA$RespA have all data, while IdaEmpB$RespB is missing value 5.
But when I try to see which values were correct, I get this:
> comparacaoA$tM
[1] 1 2 3 4 5 6 7
> comparacaoB$tM
[1] 1 2 3 4 5 6 7
I had think it could be because of that allowAll=TRUE I did not use, so I tried again, using it, and got this:
comparacaoA <- compare(BaseIda$Id,IdaEmpA$RespA,allowAll=TRUE)
comparacaoB <- compare(BaseIda$Id,IdaEmpA$RespB,allowAll=TRUE)
> comparacaoA
TRUE
> comparacaoB
FALSE
  coerced from <NULL> to <integer>
  shortened model
  sorted
> comparacaoA$tM
[1] 1 2 3 4 5 6 7
> comparacaoB$tM
[1] 1
The expected return should be:
> comparacaoA$tM
[1] 1 2 3 4 5 6 7
> comparacaoB$tM
[1] 1 2 3 4 6 7
Can someone help me understand what am I missing? What am I doing wrong?
 
     
     
    