In R (4.4.0), I found that the base function merge
accepts an argument iby
in place of by
. The RGUI with vanilla setting reproduces the same result for two different computers I have.
However, when I investigate the source code of base::merge
by getAnywhere(merge.data.frame)
, there is not mention of iby
argument. Thus, I have no idea why iby
argument can successfully run.
Can anybody tell why this is the case? What are the mechanisms behind?
df1 <- data.frame(ID = c(1, 2, 3), Name = c("Alice", "Bob", "Charlie"), stringsAsFactors = FALSE)
df2 <- data.frame(ID = c(1, 2, 4), Age = c(24, 25, 26), stringsAsFactors = FALSE)
result_iby <- merge(df1, df2, iby = "ID")
result_by <- merge(df1, df2, by = "ID")
print(result_iby)
aby
,bby
,aaby
. For instance,result_iby <- merge(df1, df2, aaby = "ID"); identical(result_iby, result_by)
returnsTRUE
.