merge {hashmap}R Documentation

Merge two Hashmaps

Description

merge method for Hashmap class

Usage

## S3 method for class 'Rcpp_Hashmap'
merge(x, y, type = c("inner", "left", "right", "full"),
  ...)

Arguments

x

an object created by a call to hashmap.

y

an object created by a call to hashmap.

type

a character string specifying the type of join, with partial argument matching (abbreviation) supported.

...

not used.

Details

Valid arguments for type are:

The default value for type is "inner".

Value

a data.frame.

Examples

hx <- hashmap(LETTERS[1:5], 1:5)
hy <- hashmap(LETTERS[4:8], 4:8)

## inner join
merge(hx, hy)

merge(
    hx$data.frame(),
    hy$data.frame(),
    by = "Keys",
    sort = FALSE
)

## left join
merge(hx, hy, "left")

merge(
    hx$data.frame(),
    hy$data.frame(),
    by = "Keys",
    all.x = TRUE,
    sort = FALSE
)

## right join
merge(hx, hy, "right")

merge(
    hx$data.frame(),
    hy$data.frame(),
    by = "Keys",
    all.y = TRUE,
    sort = FALSE
)

## full outer join
merge(hx, hy, "full")

merge(
    hx$data.frame(),
    hy$data.frame(),
    by = "Keys",
    all = TRUE,
    sort = FALSE
)

[Package hashmap version 0.2.2 Index]