Please see example below
require(data.table) #latest github version
DT1 <- data.table(sex = rep(1:2, 5),
group = rep(letters[1:5], 2),
V1 = 1:10)
DT2 <- data.table(group = rep(letters[1:5], 2), # note the different order
sex = rep(1:2, 5),
V2 = 1:10)
merge(
DT1, DT2, by = c("sex", "group")
)
# WRONG! sex should be numbers and group letters
# sex group V1 V2
#1: a 1 1 1
#2: a 2 6 6
#3: b 1 7 7
#4: b 2 2 2
#5: c 1 3 3
#6: c 2 8 8
#7: d 1 9 9
#8: d 2 4 4
#9: e 1 5 5
#10: e 2 10 10
sessionInfo()
#R version 3.2.2 (2015-08-14)
#Platform: x86_64-pc-linux-gnu (64-bit)
#Running under: Ubuntu 14.04.2 LTS
#
#locale:
# [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
# [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
# [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
# [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
# [9] LC_ADDRESS=C LC_TELEPHONE=C
#[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
#attached base packages:
#[1] stats graphics grDevices utils datasets
#[6] methods base
#
#other attached packages:
#[1] data.table_1.9.5
#
#loaded via a namespace (and not attached):
#[1] tools_3.2.2 chron_2.3-47
The bug was introduced probably the last week. (Edited with simpler example)
Please see example below
The bug was introduced probably the last week. (Edited with simpler example)