Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support columns of values that use units (from the units R package) #417

Closed
scotbader8858 opened this issue Nov 24, 2019 · 3 comments
Closed

Comments

@scotbader8858
Copy link

The units R package (https://github.com/r-quantities/units) supports vectors that have units attached. When in a table, and introduced to gt, these values have their units well-defined (separately as numerator and denominator) and they can be mixed_units (where each element should be checked for their units).

It would be really cool if gt could take advantage of these attached units and display them with nice typography. I guess the package could automatically format a column with units or there could be a specialized formatter function that would have to be used to force the formatting to occur. Either way, this would be really great.

@rich-iannone
Copy link
Member

This is a great idea for a feature request! Thanks for filing this issue.

@brunj7
Copy link

brunj7 commented Apr 9, 2020

I really like this idea. I think if you could add units to your gt table model as a special (sub)header that would be really powerful. An example: Streamflow would be the header name and m3/s would be the unit of the subheader. Relying on units and/or udnits2 to standardize them would be really useful to help promote the standardization of units when publishing tables.

We did some work on an R package metajam to bring data and metadata together from our data repository. I think if gt could enable adding metadata such as units to the table that would be really useful to scientists.

@rich-iannone rich-iannone added this to the FUTURE milestone Aug 22, 2022
@rich-iannone rich-iannone modified the milestones: FUTURE, v0.9.0 Dec 17, 2022
@rich-iannone rich-iannone modified the milestones: v0.9.0, v0.10.0 Feb 15, 2023
@rich-iannone rich-iannone modified the milestones: v0.10.0, v0.9.1 Aug 5, 2023
@rich-iannone
Copy link
Member

We now generally have good support for units in the dev version of gt. There are the specialized functions cols_units() (https://gt.rstudio.com/reference/cols_units.html), fmt_units() (https://gt.rstudio.com/reference/fmt_units.html), and better support for units in cols_label() (https://gt.rstudio.com/reference/cols_label.html). While we're not using the units package, I think the original goal was achieved (having nicely-formatted units in the column labels and within table cells).

@rich-iannone rich-iannone modified the milestones: v0.9.1, v0.10.0 Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants