merge_studies: Merge study data by identifiers

View source: R/design_structure.R

merge_studiesR Documentation

Merge study data by identifiers

Description

Merge study data by identifiers

Usage

merge_studies(x, y, by, join = c("inner", "full", "left"))

Arguments

x, y

Base data frames, or simulab_sim objects, to join.

by

Identifier variables shared by both inputs. A character vector of at least one name present in both.

join

Join type, one of "inner" (the default), keeping only matched identifiers, "full", keeping every row of both inputs, or "left", keeping every row of x.

Value

A simulab_sim base data.frame containing the merged data, sorted by by as merge() leaves it, with unmatched cells filled with NA under the "full" and "left" joins.

Examples

x <- data.frame(id = 1:5, baseline = 1:5)
y <- data.frame(id = 1:5, outcome = 6:10)
merge_studies(x, y, by = "id")

simulab documentation built on Oct. 15, 2026, 5:08 p.m.