| compare_tables | R Documentation |
For every modelled column: missing fraction in both; for numeric and date
columns the mean, SD and median and the Kolmogorov-Smirnov distance; for
categorical columns the total variation distance between label
distributions. self_match is the share of subject cells equal to the
same row's original cell; for categorical columns chance_match gives
what a random redraw from the marginal would produce, so a large excess
points at a column that copies its own row.
compare_tables(orig, syn, spec, rows = seq_len(nrow(orig)))
orig, syn |
Raw character data.frames in the same layout. |
spec |
The shared spec. |
rows |
Rows to compare (default: all). |
A data.frame, one row per modelled column.
df <- data.frame(id = sprintf("AB%03d", 1:60), value = 1:60,
code = rep(c(0, 1, NA), 20), group = rep(c("A", "B"), 30))
path <- file.path(tempdir(), "compare_tables.csv")
utils::write.csv(df, path, row.names = FALSE, na = "")
src <- read_source(path)
spec <- infer_spec(src)
syn <- src$raw
syn$value <- rev(syn$value)
compare_tables(src$raw, syn, spec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.