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

printing of units #86

Open
edzer opened this issue Jan 12, 2018 · 2 comments
Open

printing of units #86

edzer opened this issue Jan 12, 2018 · 2 comments

Comments

@edzer
Copy link
Member

edzer commented Jan 12, 2018

We have now

> set_units(1, m/s/kg)
# 1 m/kg/s

but that is against NIST recommendations, see. 6.1.6.

@t-kalinowski
Copy link
Contributor

see #89, in particular, I wonder of offloading this to the C library through ud.format (ut_format) will solve this.

@edzer
Copy link
Member Author

edzer commented Jan 21, 2018

For this case yes:

> units:::R_ut_format(units:::R_ut_parse("m/s/kg"))
[1] "m·kg⁻¹·s⁻¹"

but more in general, e.g.

> units:::R_ut_format(units:::R_ut_parse("mile/gallon"))
[1] "425143.683171079 m⁻²"

we see that udunits brings everything back to a constant and powers on the 7 base units. This is of course correct, but not readable:

  • ++ the UTF-8 formatting of multiply and powers (which it also parses)
  • -- loss of reference/readability
  • -- no control over the precision with which the constant is printed, e.g. in the header of a tibble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants