0

A has columns a,b,c,d B has columns a,b,c,e

merged = merge(A,B,by = c("a","b","c"), all.x = TRUE, sort = FALSE)
A$difference = merged$d - A$d
sum(A$difference) # <- this is unequal 0

How is this possible? All columns are numerical values and every a,b,c value from A is also in B

This is my exact Code:

A = d[c("OpTyp","DeltaOffset","Size","Duration")]
B = d.aggregated[c("OpTyp","DeltaOffset","Size","mean_Duration")]
merged = merge(A,B,by = c("OpTyp","DeltaOffset","Size"), all.x = TRUE, sort = FALSE)

merged$difference = A$Duration - merged$Duration
sum(merged$difference)
Fabse
  • 1
  • 1
  • What are `d` and `d.aggregated` objects? –  Oct 16 '15 at 12:01
  • can you provide sample data for A and B – Ronak Shah Oct 16 '15 at 12:01
  • This discusses how to ask a question on SO: http://stackoverflow.com/help/mcve – G. Grothendieck Oct 16 '15 at 12:06
  • Please re-read the link @G.Grothendieck provided (and maybe this one too, specific for R: [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)). Your question is still not reproducible, as we have no idea what's in `d` or in `d.aggregated`. – Heroka Oct 16 '15 at 12:15

0 Answers0