Skip to content

Instantly share code, notes, and snippets.

@brshallo
Created August 4, 2022 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brshallo/9c64e80fffb5120ca5e4f38dc4aa79b1 to your computer and use it in GitHub Desktop.
Save brshallo/9c64e80fffb5120ca5e4f38dc4aa79b1 to your computer and use it in GitHub Desktop.
library(dplyr)
c_sort_collapse <- function(...){
c(...) %>%
sort() %>%
paste(collapse = ".")
}
unique_combs <- function(...){
list(...) %>%
purrr::pmap_chr(c_sort_collapse) %>%
unique()
}
unique_combs(c("a", "b", "a"), c("a", "a", "b"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment