Description Usage Arguments Value Examples
View source: R/mergeWithColPrioritization.R
Merger (outer join) of two data.tables with repeated columns where we want to prioritize the values of one data.table.
1 | mergeWithColPrioritization(dt_prior, dt_other, v_s_keys)
|
dt_prior |
data.table for which has prioritized columns. |
dt_other |
data.table wich we want to merge. |
v_s_keys |
character vector of column names to merge by. |
data.table of prioritized merger of dt_prior and dt_other.
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(data.table)
i_num <- 3
dt_prior <- data.table( id = 1:i_num,
var1 = letters[1:i_num],
var2 = 111)
dt_other <- data.table( id = 1:(i_num+2),
var1 = paste0(letters[10 + 1:(i_num+2)],letters[10 + 1:(i_num+2)]) ,
var3 = -999)
v_s_keys <- "id"
dt_prior
dt_other
mergeWithColPrioritization(dt_prior, dt_other,v_s_keys )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.