Unexpected output when combining expand_grid with do.call / lift_dl

Crossposting from here https://stackoverflow.com/questions/62634967/unexpected-output-when-combining-expand-grid-with-do-call-lift-dl

When using tidyr::expand_grid in combination with do.call (or lift_dl) the output is not the same compared to a direct call of the function with multiple (tibble) elements.


dat <- list(tibble(a = 1:2), NULL, tibble(b = 2))
tidyr::expand_grid(dat[[1]], dat[[2]], dat[[3]], .name_repair = "minimal")

Different result when using do.call or lift_dl:

do.call(tidyr::expand_grid, c(dat, list(.name_repair = "minimal"))) # version do.call
purrr::lift_dl(expand_grid)(dat, .name_repair = "minimal") # version lift_dl

Using latest tidyr on cran (1.1.0)

Any ideas why?

here is a do.call that does give the same result

do.call(tidyr::expand_grid, c(dat[[1]], dat[[2]], dat[[3]], .name_repair = "minimal"))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.