Skip to content

Infinite recursion on bind_rows for labelled_spss vectors #557

@gorcha

Description

@gorcha

The haven_labelled_spss class ends up in an infinite loop when using bind_rows().
I think this is because the vctrs casting/coercion methods haven't been implemented for haven_labelled_spss as they have for haven_labelled.

library(dplyr, warn.conflicts = FALSE)
library(haven)

x <- tibble(a = labelled(1))
x
#> # A tibble: 1 x 1
#>           a
#>   <dbl+lbl>
#> 1         1
bind_rows(x, x)
#> # A tibble: 2 x 1
#>           a
#>   <dbl+lbl>
#> 1         1
#> 2         1
rbind(x, x)
#> # A tibble: 2 x 1
#>           a
#>   <dbl+lbl>
#> 1         1
#> 2         1

x <- tibble(a = labelled_spss(1))
x
#> # A tibble: 1 x 1
#>           a
#>   <dbl+lbl>
#> 1         1
bind_rows(x, x)
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
rbind(x, x)
#> # A tibble: 2 x 1
#>           a
#>   <dbl+lbl>
#> 1         1
#> 2         1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorlabelled_spss

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions