Learn R Programming

crunch (version 1.14.4)

joinDatasets: Add columns from one dataset to another, joining on a key

Description

As merge does for data.frames, this function takes two datasets, matches rows based on a specified key variable, and adds columns from one to the other.

Usage

joinDatasets(x, y, by = intersect(names(x), names(y)), by.x = by, by.y = by, all = FALSE, all.x = TRUE, all.y = FALSE, copy = TRUE)
extendDataset(x, y, by = intersect(names(x), names(y)), by.x = by, by.y = by, all = FALSE, all.x = TRUE, all.y = FALSE, ...)
"merge"(x, y, by = intersect(names(x), names(y)), by.x = by, by.y = by, all = FALSE, all.x = TRUE, all.y = FALSE, ...)

Arguments

x
CrunchDataset to add data to
y
CrunchDataset to copy data from. May be filtered by rows and/or columns.
by
character, optional shortcut for specifying by.x and by.y by alias if the key variables have the same alias in both datasets.
by.x
CrunchVariable in x on which to join, or the alias (following crunch.namekey.dataset) of a variable. Must be type numeric or text and have all unique, non-missing values.
by.y
CrunchVariable in y on which to join, or the alias (following crunch.namekey.dataset) of a variable. Must be type numeric or text and have all unique, non-missing values.
all
logical: should all rows in x and y be kept, i.e. a "full outer" join? Only FALSE is currently supported.
all.x
logical: should all rows in x be kept, i.e. a "left outer" join? Only TRUE is currently supported.
all.y
logical: should all rows in y be kept, i.e. a "right outer" join? Only FALSE is currently supported.
copy
logical: make a virtual or materialized join. Default is TRUE, which means materialized. Virtual joins are experimental and not advised.
...
additional arguments, ignored

Value

x extended by the columns of y, matched on the "by" variables.