Skip to content

Extract vector classes to a separate package? #136

@krlmlr

Description

@krlmlr

I would like to offer more options to format numbers in the tibble package. The "formattable" class looks like an excellent start. I have found the following functions, have I missed any?

  • accounting()
  • comma()
  • currency()
  • digits()
  • percent()
  • prefix()
  • scientific()
  • suffix()

I would add a pillar_shaft() method for the "formattable" class to ensure that the numbers are aligned properly and to add color. (The existing format.formattable() method doesn't seem to add padding spaces like the default method does, is this by design?)

I would change a few things, though:

  • Add a common prefix, e.g. val_ or num_, to all constructors. (The fmt_ prefix would create collisions with gt and huxtable.)
  • Avoid S3 dispatch in constructors, instead implement parse_xxx_....() functions for character input
  • Maybe add a Math method (is there a reason you went for overloading the individual operators?)

Because formattable brings in a few heavy dependencies, I'd rather create a new package from which formattable could import. What's the best way to move forward?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions