Attach unique IDs as the key column
cdr_make_unique_ids.Rd
Attach unique IDs as the key column
Arguments
- db_tbl
a dataframe
- key_field
the name of the column with the Unique ID
- use_guid
use a 12 digit GUID instead of the default format
Examples
cdr_make_unique_ids(utils::head(iris,11))
#> Auto generating Unique IDs for the table.
#> # A tibble: 11 × 6
#> UID Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <chr> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 ID-01 5.1 3.5 1.4 0.2 setosa
#> 2 ID-02 4.9 3 1.4 0.2 setosa
#> 3 ID-03 4.7 3.2 1.3 0.2 setosa
#> 4 ID-04 4.6 3.1 1.5 0.2 setosa
#> 5 ID-05 5 3.6 1.4 0.2 setosa
#> 6 ID-06 5.4 3.9 1.7 0.4 setosa
#> 7 ID-07 4.6 3.4 1.4 0.3 setosa
#> 8 ID-08 5 3.4 1.5 0.2 setosa
#> 9 ID-09 4.4 2.9 1.4 0.2 setosa
#> 10 ID-10 4.9 3.1 1.5 0.1 setosa
#> 11 ID-11 5.4 3.7 1.5 0.2 setosa
cdr_make_unique_ids(utils::head(iris,11), key_field = 'GUID', use_guid = TRUE)
#> Auto generating Unique IDs for the table.
#> # A tibble: 11 × 6
#> GUID Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <chr> <dbl> <dbl> <dbl> <dbl> <fct>
#> 1 18c4aebd5457 5.1 3.5 1.4 0.2 setosa
#> 2 4445135283ff 4.9 3 1.4 0.2 setosa
#> 3 1dd4324fbaf0 4.7 3.2 1.3 0.2 setosa
#> 4 53c080368a71 4.6 3.1 1.5 0.2 setosa
#> 5 a11af8837235 5 3.6 1.4 0.2 setosa
#> 6 91099b1d0435 5.4 3.9 1.7 0.4 setosa
#> 7 9b966af9c6c0 4.6 3.4 1.4 0.3 setosa
#> 8 6d60585b9544 5 3.4 1.5 0.2 setosa
#> 9 09e7a1f42ec2 4.4 2.9 1.4 0.2 setosa
#> 10 2bf8e8b0d65e 4.9 3.1 1.5 0.1 setosa
#> 11 17356662935e 5.4 3.7 1.5 0.2 setosa