mergev {EdSurvey} | R Documentation |
mergev
Description
More verbose merge function
Usage
mergev(
x,
y,
by = NULL,
by.x = NULL,
by.y = NULL,
all.x = NULL,
all.y = NULL,
all = FALSE,
order = c("sort", "unsorted", "x", "y"),
fast = FALSE,
merge.type.colname = "merge.type",
return.list = FALSE,
verbose = TRUE,
showWarnings = TRUE,
...
)
Arguments
x |
first data.frame to merge, same as in |
y |
second data.frame to merge, same as in |
by |
character vector of column names to merge by. When |
by.x |
character vector of column names on |
by.y |
character vector of column names on |
all.x |
logical value indicating if unmerged rows from |
all.y |
logical value indicating if unmerged rows from |
all |
logical value indicating if unmerged rows from |
order |
character string from "sort", "unsorted", "x", and "y".
Specifies the order of the output. Setting this to "sort"
gives the same result as |
fast |
logical value indicating if |
merge.type.colname |
character indicating the column name of the resulting merge type column. See description. |
return.list |
logical value indicating if the merged data.frame and verbose output should be returned as elements of a list. Defaults to FALSE where the function simply returns a data.frame. |
verbose |
logical value indicating if output should be reported. Defaults to TRUE. Useful for testing. |
showWarnings |
logical value to output warning messages (TRUE) or suppress (FALSE). Defaults to TRUE. |
... |
additional parameters passed to merge. |
Details
This is a wrapper for the base package merge function that prints out verbose information about the merge, including the merge type (one/many to one/many), the overlapping column names that will have suffixes applied, the number of rows and the number of unique keys that are in each dataset and in the resulting dataset.
Also gives more detailed errors when, e.g. the columns named in the by
argument are
not on the x
or y
data.frames.
Value
depends on the value of return.list
.
When return.list
is FALSE
, returns a data.frame
.
When return.list
is TRUE
, returns a list with two elements. The first is the same data.frame
result. The second
is a list with the values that were printed out. Elements include merge.type with two elements, each "one" or "many" indicating the
merge type for x
and y
, respectively; inBoth, the list of column names in both merged data.frames; and merge.matrix
the matrix printed out by this function.