row_disclosure: Share of synthetic rows identical to their own original row

View source: R/compare.r

row_disclosureR Documentation

Share of synthetic rows identical to their own original row

Description

Compares the modelled columns only (identifiers are equal by design).

Usage

row_disclosure(orig, syn, spec, rows = seq_len(nrow(orig)), min_share = 0.9)

Arguments

orig, syn

Raw character data.frames in the same layout.

spec

The shared spec.

rows

Rows to compare (default: all).

min_share

Report also rows matching at least this share of cells.

Value

list(identical = share of rows fully identical, identical_unique = share of rows identical AND unique in the original (the disclosive kind), near = share of rows matching at least min_share of their cells, per_row = vector).

Examples

df <- data.frame(id = sprintf("AB%03d", 1:60), value = 1:60,
                 code = rep(c(0, 1, NA), 20))
path <- file.path(tempdir(), "row_disclosure.csv")
utils::write.csv(df, path, row.names = FALSE, na = "")
src <- read_source(path)
spec <- infer_spec(src)
syn <- src$raw
syn$value[1:30] <- rev(syn$value[1:30])
row_disclosure(src$raw, syn, spec, min_share = 0.5)

cellsynth documentation built on Oct. 31, 2026, 1:07 a.m.