Skip to contents

Left join that keeps the rows and row order of data and adds selected columns of other, matched on key columns. Keys of other must be unique.

Usage

PlotDataJoin(data, other, by, by_other = by, columns = NULL, rename = NULL)

Arguments

data

A data frame.

other

A data frame.

by

Key columns of data.

by_other

Key columns of other; default by.

columns

Columns of other to add; default all non-key columns.

rename

Optional new names for columns.

Value

data with the added columns (missing matches are NA).

Examples

a <- data.frame(id = c("p2", "p1", "p3"), v = 1:3)
b <- data.frame(key = c("p1", "p2"), group = c("A", "B"))
PlotDataJoin(a, b, by = "id", by_other = "key", columns = "group")
#>   id v group
#> 1 p2 1     B
#> 2 p1 2     A
#> 3 p3 3  <NA>