Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type stability when a df-col has 0 columns but 1 row #1189

Closed
DavisVaughan opened this issue Nov 3, 2021 · 1 comment · Fixed by #1230
Closed

Type stability when a df-col has 0 columns but 1 row #1189

DavisVaughan opened this issue Nov 3, 2021 · 1 comment · Fixed by #1230
Labels
bug an unexpected problem or unintended behavior grids #️⃣ expanding, nesting, crossing, ...

Comments

@DavisVaughan
Copy link
Member

library(tidyr)

# df-col with 1 row and 0 cols
df <- tibble(x = tibble(.rows = 1))

# should be 1 row and 0 cols
unpack(df, x)
#> # A tibble: 0 × 0

Created on 2021-11-03 by the reprex package (v2.0.1)

@DavisVaughan DavisVaughan added bug an unexpected problem or unintended behavior nesting 🐦 nesting, chopping, and packing labels Nov 3, 2021
@DavisVaughan
Copy link
Member Author

And in expand_grid() due to flatten_nested()

tidyr::expand_grid(tibble::tibble(.rows = 1))
#> # A tibble: 0 × 0

Created on 2021-11-03 by the reprex package (v2.0.1)

Best solution is probably to make flatten_at() return a data frame itself with the right number of rows (that can be promoted to a tibble as needed)

@DavisVaughan DavisVaughan changed the title unpack() issue when a df-col has 0 columns but 1 row Type stability when a df-col has 0 columns but 1 row Nov 3, 2021
@DavisVaughan DavisVaughan added grids #️⃣ expanding, nesting, crossing, ... and removed nesting 🐦 nesting, chopping, and packing labels Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior grids #️⃣ expanding, nesting, crossing, ...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant