This function merges two IDA data frames(that is, two objects of the class ida.data.frame
).
idaMerge(x, y, by=intersect(x@cols, y@cols), by.x=by, by.y=by,
all=FALSE, all.x=all, all.y=all, sort=TRUE,
suffixes=c("_x", "_y"), table=NULL)
A ida.data.frame
object.
The first ida.data.frame
object to be merged.
The second ida.data.frame
object to be merged.
Specification of the common columns; see the Details section.
Specification of the common columns; see the Details section.
Specification of the common columns; see the Details section.
Whether non-matching columns of x
and y
are to be appended to the result.
If set to FALSE, only columns common to both x
and y
are included in the output.
This parameter overrides the all.x
and all.y
parameters.
In SQL database terminology, specifying all=FALSE
results in
an inner join that is equivalent to a natural join, and specifying
all=TRUE
results in a full outer join.
In a full outer join, the columns that
are common to both x
and y
are followed by the remaining
columns in x
, which are followed by the remaining columns in y
.
If columns from only one of the IDA data frames being merged are to be included in the output,
set its corresponding parameter to TRUE and the other parameter to FALSE.
In SQL database terminology, specifying all.x=TRUE
and all.y=FALSE
results in a left outer join,
and specifying all.x=FALSE
and all.y=TRUE
results in a right outer join.
If TRUE
, then extra rows are added to the
output, one for each row in x
that has no matching row in
y
. These rows have a value of NA
in those columns
that are typically filled with values from y
. The default is
FALSE
, so that only rows with data from both x
and
y
are included in the output.
If all.x
is true, all the non matching cases of x
are
also appended to the result, with a value of NA
filled in the
corresponding columns of y
Analogous to all.x
This parameter is ignored. The output is never sorted regardless of the setting of this parameter.
Two 2-character strings, each of which specifies a suffix that is
used when generating column names.
By specifying different suffixes, you can ensure that each column
can be uniquely attributed to either x
or y
.
Note that a dot (.) is not a valid character for a column name.
Name of the output IDA data frame.
This function merges two IDA data frames on the columns that they have in common. The rows in the two data frames that match on the specified columns are extracted, and joined together. If there is more than one match, all possible matches contribute one row each. For the precise meaning of ‘match’.
If by
or both by.x
and by.y
are of length 0 (a
length zero vector or NULL
), the result, r
, is the
Cartesian product of x
and y
, that is, a cross join.
If non-merged columns of the data frames have identical names and are to be included in the output, suffixes are appended to the names of the corresponding columns in the output to make their names unique.
Note that this function creates, in the current database, a view that corresponds to the output object. Within the current session, this view can be accessed using the same IDA data frame object. However, it is persistent and, after it is no longer needed, it must be dropped manually.
ida.data.frame
if (FALSE) {
idf <- ida.data.frame('IRIS')
#Perform a self-join
idf2 <- idaMerge(idf,idf,by="ID")
}
Run the code above in your browser using DataLab