Skip to content

vec_unique() fails on lists of objects containing non-vectors #643

Description

@mikmart

In the current dev version, vec_unique() doesn’t work with lists of objects that are not vectors, or that contain non-vector elements in a recursive structure:

m <- glm(mpg ~ wt, data = mtcars)
vctrs::vec_unique(list(m, m))
#> Error: `x` must be a vector, not a `glm/lm` object

o <- list(x = expression(x))
vctrs::vec_unique(list(o, o))
#> Error: `x` must be a vector, not an expression vector

glm objects are an example of both, and can frequently appear in list columns in data frames. As vec_unique() gets more use behind the scenes in packages such as tidyr, this threatens to break code that works with list columns: e.g. tidyverse/tidyr#735 seems to be a symptom of this behaviour.

Created on 2019-11-04 by the reprex package (v0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions