Skip to content

Devel vctrs::vec_rbind does not remove column names in list columns #1007

Closed
@colearendt

Description

@colearendt

This is breaking behavior for https://github.com/colearendt/tidyjson, so wanted to report it. It is not clear to me whether this is an intentional or unintentional change in behavior. It seems marginally related to #999 and #966.

As I think about this behavior, it seems almost desirable to keep the names - it was not clear to me why names were dropped in the first place (but we do depend on it in a few places, for better or worse. Others may as well).

I originally noticed the behavior in tidyr::unnest() and traced it here:

original behavior

Notice that chr "b" is not named

packageVersion("vctrs")
#> [1] '0.2.4'
hm <- tibble::tibble(col = list(a = "b"))
str(vctrs::vec_rbind(hm, .ptype = NULL))
#> tibble [1 × 1] (S3: tbl_df/tbl/data.frame)
#>  $ col:List of 1
#>   ..$ : chr "b"

Created on 2020-04-13 by the reprex package (v0.3.0)

devel behavior

Notice that chr "b" retains its name

packageVersion("vctrs")
#> [1] '0.2.99.9011'
hm <- tibble::tibble(col = list(a = "b"))
str(vctrs::vec_rbind(hm, .ptype = NULL))
#> tibble [1 × 1] (S3: tbl_df/tbl/data.frame)
#>  $ col:List of 1
#>   ..$ a: chr "b"

Created on 2020-04-13 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions