Here is sample/test code:
A <- data.frame(a=1:4)
AB <- data.frame(a=2:4, b=1)
merge(A,AB,all.x = TRUE,sort=FALSE)
a b
1 2 1
2 3 1
3 4 1
4 1 NA
A <- data.table::data.table(a=1:4)
AB <- data.table::data.table(a=2:4, b=1)
merge(A,AB,all.x = TRUE,sort=FALSE)
a b
1: 1 NA
2: 2 1
3: 3 1
4: 4 1
This can have profound effects. Merge depends on type of A and data.frame/data.table are interchangeable in many scenario's. Changing type of A can end up causing fireworks at unexpected places.
I don't know what the correct behavior should be, but I do think the results should be the same.
Here is sample/test code:
This can have profound effects. Merge depends on type of
Aanddata.frame/data.tableare interchangeable in many scenario's. Changing type ofAcan end up causing fireworks at unexpected places.I don't know what the correct behavior should be, but I do think the results should be the same.