r-quantities / units

Measurement units for R
https://r-quantities.github.io/units
175 stars 28 forks source link

Allow sprintf.units? #345

Closed hughjonesd closed 1 year ago

hughjonesd commented 1 year ago

I wonder if you'd consider a sprintf.units method, analogous to format.units. At the moment, it works but the unit is dropped:

x <- set_units(1:3, "m/s") x
> sprintf("%.3f", x)
[1] "1.000" "2.000" "3.000"
Enchufa2 commented 1 year ago

Is that possible? I don't think this is S3 generic.

hughjonesd commented 1 year ago

Ah. In that case, never mind - my mistake.