exposeDupes | R Documentation |
Sometimes datasets are expected to be tidy but aren't, finding distinct rows of duplicated IDs is easy but finding why they're distinct in many column tables is less straight forward. This functions returns the values that resulted in any duplicated IDs in one of two forms either a named list or a tibble
exposeDupes(x, grouping_var, listout = TRUE)
x |
Tibble or Dataframe |
grouping_var |
Column to look for duplicated values |
listout |
Flag to return either list or tibble |
Named list of two-column tibbles for each value resulting in duplicate IDs
Grouping Variable
Distinct values
Tibble with the following columns
Grouping Variable
n * X.grpNdistinct number of distinct values for duplicated ID
n * X.values values for that duplicated ID
https://dplyr.tidyverse.org/articles/programming.html
List or Dataframe of results
df <- data.frame(name = sample(letters, 20, replace = TRUE), month = sample(month.name, 20, replace = TRUE), letters = sample(LETTERS[1:10], 20, replace = TRUE), nums = floor(runif(20, 1, 15))) dplyr::count(df, name) exposeDupes(df, name) exposeDupes(df, name, listout = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.