Description Usage Arguments Value Examples
Apply built-in R merge
but with additional features for
safety and information.
1 2 3 4 5 6 7 8 9 | merge_better(x, y, by.x, by.y, all.x = FALSE, all.y = FALSE,
affix = NULL, renameConflict = c("suffix", "prefix"),
renameAll = c("no", "suffix", "prefix"), convert_factors = TRUE,
verbose = FALSE)
mergeBetter(x, y, by.x, by.y, all.x = FALSE, all.y = FALSE,
affix = NULL, renameConflict = c("suffix", "prefix"),
renameAll = c("no", "suffix", "prefix"), convert_factors = TRUE,
verbose = FALSE)
|
x |
data frame |
y |
data frame |
by.x |
field in x to merge on. Unlike |
by.y |
field in y to merge on. Unlike |
all.x |
outer join to keep all x values |
all.y |
outer join to keep all y values |
affix |
either prefix or suffix to disambiguate files. By default, this
is the name of the table specified in |
renameConflict |
- determines whether prefix or suffix is added to disambiguate conflicting column names. Value can be "suffix", "prefix". Suffix is the default. |
renameAll |
- regardless of column name clashes, "prefix" or "suffix" with every field with original table name, or "no" for neither |
convert_factors |
Default is TRUE which causes factors to be converted to character before merge. This is almost certainly safer. |
verbose |
logical or numbers 0, 1 or 2. 1 or TRUE will give moderate verbosity, 2 will give full verbosity. 0 or FALSE turns off all messages. |
merged data frame
1 2 3 | df <- data.frame(a = c("1", "2"), b = 1:2, stringsAsFactors = FALSE)
eg <- data.frame(a = c("1", "3"), b = 3:4, stringsAsFactors = FALSE)
mergeBetter(x = df, y = eg, by.x = "a", by.y = "a", verbose = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.