Skip to content

Deprecate cross() and cross_df() #768

Description

@lionel-

There is tidyr::expand_grid() which doesn't have these issues. The ordering of combinations is not the same, but probably not a big deal:

data <- list(
  id = c("John", "Jane"),
  greeting = c("Hello.", "Bonjour."),
  sep = c("! ", "... ")
)

data %>%
  cross() %>%
  map_chr(lift(paste))
#> [1] "John! Hello."     "Jane! Hello."     "John! Bonjour."   "Jane! Bonjour."
#> [5] "John... Hello."   "Jane... Hello."   "John... Bonjour." "Jane... Bonjour."

tidyr::expand_grid(!!!data) %>%
  pmap_chr(paste)
#> [1] "John! Hello."     "John... Hello."   "John! Bonjour."   "John... Bonjour."
#> [5] "Jane! Hello."     "Jane... Hello."   "Jane! Bonjour."   "Jane... Bonjour."

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions