Skip to contents

Assigns a unique lineage identifier (.__lid__) to every row and registers the dataset in the active session store. This is the entry point to lineager : all other functions require a tagged data frame.

Usage

lg_tag(data, dataset_id, domain = NULL, label = NULL, source = NULL)

Arguments

data

A data.frame or tibble.

dataset_id

Character. Short identifier for this dataset, e.g. "LB", "ADLB", "ADSL". Used as the prefix in lineage IDs and in report output.

domain

Character or NULL. CDISC domain code if applicable (e.g. "DM", "LB", "AE"). Used for SDTM-to-ADaM mapping and Reviewer's Guide output.

label

Character or NULL. Human-readable label for the dataset (e.g. "Laboratory test results"). Used in reports.

source

Character or NULL. Source file or system description.

Value

An lg_df object : a data.frame with a .__lid__ column and lineage metadata stored in attributes.

Details

The .__lid__ column is added at position 1 and is preserved through lg_filter(), lg_derive(), and lg_join() operations. It allows every row in any downstream dataset to be traced back to its origin.

Examples

lg_start()
#> lineager: session started

dm <- data.frame(
  USUBJID = c("01-001", "01-002", "01-003"),
  AGE     = c(34L, 52L, 47L),
  SEX     = c("M", "F", "M")
)

dm_tagged <- lg_tag(dm, dataset_id = "DM", domain = "DM",
                    label = "Demographics")
#> lineager: tagged 'DM' — 3 rows, 3 cols
dm_tagged
#> <lg_df> 'DM' (domain: DM)  [3 × 4]
#>   USUBJID AGE SEX
#> 1  01-001  34   M
#> 2  01-002  52   F
#> 3  01-003  47   M