merge2 {lazy.tools}R Documentation

Merge two data frames and return the result with the contribution indices

Description

Merge two data frames and return the result with the contribution indices

Usage

merge2(x, y, ..., .inx. = "in.x", .iny. = "in.y")

Arguments

x

First data frame.

y

Second data frame.

...

parameters to the native merge frunction.

.inx.

The name of the contribution index for x.

.iny.

The name of the contribution index for y.

Details

The SAS like contribution indices will be returned as the variables of the merged data frame.

In the followint example, those observations with in.x=1 are contributed from data frame x, and those with in.y=1, from y.

Examples

d1 <- data.frame(x=c(11:15, 17:20),y=c(111:115, 117:120))
d1[2,2] <- NA
d2 <- data.frame(x=c(11:13, 16, 18:21),y=c(211:213, 216, 218:221))
d2[5,2] <- NA
d12 <- merge2(d1,d2, by="x", all=TRUE)
printm( d1, d2, d12 )

D12 <- merge2(d1,d2, by="x", all=TRUE, .inx.="IN1")
printm( d1, d2, D12 )


[Package lazy.tools version 0.1.4 ]