Skip to contents

Merges two or more harmonised data.frames, auto-detecting common ID columns when by is not specified. Warns on unexpected row expansion from many-to-many joins.

Usage

ihs_merge(..., by = NULL, type = "left")

Arguments

...

Two or more data.frames to merge.

by

Character vector of columns to join by. If NULL (default), auto-detects common ID columns from a standard set.

type

Join type: "left" (default), "inner", or "full".

Value

A merged data.frame with an ihs_merge_log attribute containing row counts at each merge step.

Examples

if (FALSE) { # \dontrun{
  hh <- haven::read_dta("hh_mod_a.dta") |> ihs_harmonise("IHS5")
  ag <- haven::read_dta("ag_mod_a.dta") |> ihs_harmonise("IHS5")
  merged <- ihs_merge(hh, ag)
} # }