merge_with_precedence {cmapR} | R Documentation |
data.frame
s, but where there are common fields
those in x
are retained and those in y
are dropped.Merge two data.frame
s, but where there are common fields
those in x
are retained and those in y
are dropped.
merge_with_precedence(x, y, by, allow.cartesian = TRUE, as_data_frame = TRUE)
x |
the |
y |
another |
by |
a vector of column names to merge on |
allow.cartesian |
boolean indicating whether it's ok for repeated values in either table to merge with each other over and over again. |
as_data_frame |
boolean indicating whether to ensure
the returned object is a |
a data.frame
or data.table
object
data.table::merge
(x <- data.table::data.table(foo=letters[1:10], bar=1:10)) (y <- data.table::data.table(foo=letters[1:10], bar=11:20, baz=LETTERS[1:10])) # the 'bar' column from y will be dropped on merge cmapR:::merge_with_precedence(x, y, by="foo")