composite_primary_keys: Find what columns a data set is unique by

Description Usage Arguments Examples

Description

Find what columns a data set is unique by

Usage

1
composite_primary_keys(data, expected_primary_keys)

Arguments

data

Dataframe to find primary keys of

expected_primary_keys

List form of columns that should identify the dataset uniquely

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data <- data.frame(a = c(1, 2, 3, 4, 5, 6),
                        b = c(1, 2, 2, 3, 4, 5),
                        c = c('a', 'b', 'b', 'c', 'd','e'),
                        id = c(1111, 2222, 2222, 3333, 4444, 5555))
nrow(data)
n_distinct(data$id)
primary_keys <- composite_primary_keys(data, c("id"))
print(primary_keys)

composite_primary_keys()

skvorekn/skvoRtex documentation built on June 22, 2019, 12:45 a.m.