idaMerge {ibmdbR}R Documentation

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

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

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 that a dot (.) is not a valid character for a column name.

table

Name of the output IDA data frame.

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

Value

A ida.data.frame object.

See Also

ida.data.frame

Examples

## Not run: 

idf <- ida.data.frame('IRIS')

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


## End(Not run)


[Package ibmdbR version 1.51.0 Index]