Skip to content

Feature Request - Implement vctrs methods to support tidyr  #155

@nir4most

Description

@nir4most

Example to show issue encountered when attempting to pivot a formatted data.frame.

Reprex:

library(formattable)
library(tidyr)

(exampledf_unformatted <- data.frame(
  index = letters[1:5],
  curr1 = 1:5,
  curr2 = 6:10
))

pivot_longer(exampledf_unformatted,cols=-1)


(exampledf_formatted <- data.frame(
  index = letters[1:5],
  curr1 = currency(1:5),
  curr2 = currency(6:10)
))

pivot_longer(exampledf_formatted,cols=-1)

Error:

Error: Can't combine `curr1` <formattable> and `curr2` <formattable>.
x Some attributes are incompatible.
i The author of the class should implement vctrs methods.
i See <https://vctrs.r-lib.org/reference/faq-error-incompatible-attributes.html>.

Session Info:

> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

other attached packages:
[1] tidyr_1.1.3         formattable_0.2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions