Skip to content

use of tibble::num() breaks display by other packages #1619

Open
@twest820

Description

@twest820

Using num() to get better tibble display formatting has the ironic side effect of causing formatting paths in other packages to fail. Here's a trivial repex.

foo = tibble(a = tibble::num(seq(0, 10, by = 3.2), digits = 1))
table(foo$a)
Error in `as.character()`:
! Can't convert `x` <pillar_num:.1!> to <character>.
# workaround: table(as.numeric(foo$a))

It's difficult to inventory all the code paths which can call as.character() on a column using the num() constructor but, from the few places I've used num() with tibble 3.2.1 so far, impact seems likely widespread across at least base and ggplot.

This was raised in ggplot nearly two years ago (tidyverse/ggplot2#5284) but doesn't appear to have gotten forwarded to tibble or pillar as suggested there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions