merge_stata: Use dplyr to emulate Stata merges.

Description Usage Arguments

View source: R/joins.r

Description

Use dplyr to emulate Stata merges.

Usage

1
2
merge_stata(x, y, multi = c("1:1", "1:m", "m:1", "1:1 _n"), by = NULL,
  keep = "inner", keepusing = NULL, ...)

Arguments

x

A dataframe to merge ('master' in Stata)

y

A dataframe to merge ('using' in Stata)

multi

What multiple matches are allowed? One of "1:1", "1:m", "m:1", or "1:1 _n". Note that m:m matches aren't allowed because they're ill-defined. You can use standard dplyr joins if you instead want the cartesian product (equivalent to Stata's joinby).

by

Variables to join by (as strings)

keep

Observations to keep. Can be specified with Stata words (1, 2, 3, "master", "using", "match") or SQL words ("left", "right", "full", "semi").

keepusing

Variables from the y ('using') dataset to keep.

...

Other arguments passed onto the dplyr *_join function.


karldw/kdw.junk documentation built on Dec. 24, 2018, 1:07 a.m.