Learn R Programming

ibmdbR (version 1.36.7)

idaMerge: Merge IDA data frames

Description

This function merges two IDA data frames(that is, two objects of the class ida.data.frame).

Usage

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)

Arguments

x
The first ida.data.frame object to be merged.
y
The second ida.data.frame object to be merged.
by
Specification of the common columns; see the Details section.
by.x
Specification of the common columns; see the Details section.
by.y
Specification of the common columns; see the Details section.
all
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<
all.x
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
all.y
Analogous to all.x
sort
This parameter is ignored. The output is never sorted regardless of the setting of this parameter.
suffixes
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
table
Name of the output IDA data frame.

Value

  • A ida.data.frame object.

Details

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. 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.

See Also

ida.data.frame

Examples

Run this code
idf <- ida.data.frame('IRIS')

#Perform a self-join
idf2 <- idaMerge(idf,idf,by="ID")

Run the code above in your browser using DataLab