Skip to content

chop() returns the wrong result with empty data frames #1206

@DavisVaughan

Description

@DavisVaughan
library(tidyr)

df <- tibble(x = 1, y = 2)

chop(df, y)
#> # A tibble: 1 × 2
#>       x           y
#>   <dbl> <list<dbl>>
#> 1     1         [1]

# Should be y=list<dbl>
chop(df[0,], y)
#> # A tibble: 0 × 2
#> # … with 2 variables: x <dbl>, y <dbl>

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviornesting 🐦nesting, chopping, and packing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions