Learn R Programming

jwutil (version 1.1.1)

mergeBetter: merge better

Description

apply built-in R merge but with additional features:

Usage

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)

Arguments

x

data frame

y

data frame

by.x

field in x to merge on. Unlike merge, this is compulsory.

by.y

field in y to merge on. Unlike merge, this is compulsory.

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 y. In all other respects in this function, x and y are symmetric.

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.

Value

merged data frame