Changelog
Source:NEWS.md
version 1.0-0
Breaking change: a new tokenizer fixes longstanding issues with parsing complex unit expressions, but may break existing code that relied on the previous (buggy) behavior. The major change is that now numbers are consistently treated as prefixes, so that units like
ml / min / 1.73m^2
used in physiology are now correctly parsed asml / (min * 1.73 * m^2)
. See?as_units
for details; #416 addressing #221, #383Printing: follow NIST recommendations. In particular, numerator and denominator are separated by a single slash, and a parenthesis is used when the denominator contains several symbols (see example above); #86
Loading units no longer initializes the RNG state; #409
Fix scale training in
ggplot2
scales; #412Add
scale_{type}_units()
scales for additional continuous aesthetics (colour, fill, alpha, size, linewidth); #369Implement
matrixOps.units
, with support for%*%
(R >= 4.3.0); #226New
convert_to_base()
implements conversion to base units; #132 @jamarav
version 0.8-7
CRAN release: 2025-03-11
Deep copy of
ud_convert()
input to avoid side effects; #403Set C++17 standard for old versions of R; #402
version 0.8-6
CRAN release: 2025-03-07
Add methods for
cbind
andrbind
; fixes #311Performance improvements in
data.frame
methods; suggested in #361 @grcatlinFix
weighted.mean.units
for unitless objects; #363Fix incorrect use of
round()
in%%
and%/%
methods; #365 @UchidaMizukiFix
ggplot2
deprecation warnings; #367Fix simplification of inverse units; #378
Replace call to
Rf_error()
withRcpp::stop()
; RcppCore/Rcpp#1247Fix UBs in the C++ glue code; #380
Add support for
brew
path discovery in macOS; #384Several performance improvements; #387, #388, #393, #400 addressing #386, #389
Improve
keep_units()
helper for more general usage scenarios; #394 @d-morrison addressing #392Add
ud_convert()
to convert units of a vector; #399 @dlebauer addressing #398Fix
scale_units
for upcoming version of ggplot2; #401
version 0.8-4
CRAN release: 2023-09-13
Identical unit division and multiplication will now respect
units_options(simplify = FALSE)
reverting a change from #310; #355 @billdenneyFix
scale_units
when bothunit
andtrans
are specified; #357
version 0.8-2
CRAN release: 2023-04-27
Names are preserved when doing unit conversions; #305 @billdenney
Identical units will always divide (
/
) and allow integer division (%/%
). And, inverse units will always be able to multiply; #310 @billdenneyCompare units via
ud_compare()
, fixing inconsistent results for aliases and symbols; #339, #346, #347Fix
units<-()
to treat an empty unit the same asNULL
; #332New
as.data.frame()
method formixed_units
; #309Use short paths for database loading on Windows to fix UTF-16 issues; #342
Add example in the docs about reversing a ggplot2 units scale; #343
Fix units in transformed axis; #323
Consider unitless as radians in trigonometric functions; #328
version 0.8-0
CRAN release: 2022-02-04
enhance unit mapping for newly installed units; #290
remove deprecations:
install_symbolic_unit
,remove_symbolic_unit
,install_conversion_constant
,install_conversion_offset
; #290fix multipliers for round trip log-exp operations; #292
integrate
ggplot2
scales (previously in theggforce
package) to automatically print axes with units; #294 addressing #164fix
all.equal.units
for non-unitscurrent
fix zero power; #285
fix
unique.units
to support arrays and matrices, implement methods forduplicated
andanyDuplicated
always add units to labels, including user-provided ones; as part of #298
new symbols/names with a percentage character are not allowed due to an upstream bug; #289
version 0.7-0
CRAN release: 2021-02-25
add
load_units_xml
to enable database reloading as well as loading user-provided unit systems; #254 addressing #243, #244add
install_unit
andremove_unit
for adding/removing custom user-defined symbols or names, with optional mapping to existing units;install_symbolic_unit
,remove_symbolic_unit
,install_conversion_constant
,install_conversion_offset
are deprecated; #261 addressing #89add
keep_units
, a helper to apply functions that do not preserve units; #255 addressing #252fix
as_units("")
, which is now equivalent tounitless
; #199fix plot axes for
plot.formula
andplot.data.frame
; #213fix arithmetic for powers above 1 and below -1; #264
improve arithmetic of logarithms; #249
remove deprecations:
as.units
,as_cf
,make_unit
,parse_unit
; #259remove deprecated pre-computed
ud_units
database; #259
version 0.6-5
CRAN release: 2019-10-08
- skip test on CRAN to avoid issues with strict latin1 environments
version 0.6-0
CRAN release: 2018-06-09
print units as [unit] more consistently, e.g. for single unit and in data.frames; #132
improve printing of unitless units; provide option to print something else than 1; #150
fix printing unitless in labels when
negative_power
isTRUE
; #133install_symbolic_unit
now adds a dimensionless unit, integrated in the units system, meaning that prefixes on it work as well; #71install_conversion_constant
andinstall_conversion_offset
now install a new unit that is a function of an existing udunits unit.; #71, #84unit simplification can now be user-controlled by
units_options
; #89set_units(15, mg/kg)
is now no longer simplified to 1e-9 unitless; #89directly uses the udunits2 C library; drop dependence on R package
udunits2
, fixing R packageudunits2
memory leaks; #135drops
%*%
, no longer gives warning when loading
version 0.5-0
CRAN release: 2018-01-07
deal with trigonometric functions for units degree; return units rad on inverse trigonometric functions.
Unit creation has been significantly refactored.
units<-
now accepts strings or quoted language objects on the right hand side, powered by new S3 methods foras_units
. All valid unit symbols and unit names recognized by package ‘udunits2’ are now accepted. New user facing functionmake_units()
(plural s) is also provided. See?as_units
for details. @t-kalinowskinew functions
valid_udunits()
andvalid_udunits_prefixes()
generate tidy dataframes listing all the valid unit names, symbols, and prefixes recognized by udunits. @t-kalinowskinew function
install_symbolic_unit()
for adding custom, user-defined units. @t-kalinowskimake_unit
andparse_unit
(singular unit) have been deprecated, please useas_units
instead.ud_units
is no longer necessary and is soft-deprecated, and may be removed in a future release.add
%*%
as an S3 generic; #54add
%%
and%/%
toOps.units
support unary + and - ; #56
add
seq
method forunits
, converting units to those of the first argumentDeprecate
as.dt
foras_difftime
,as.units
foras_units
andas_cf
fordeparse_unit
version 0.4-6
CRAN release: 2017-08-27
add
all.equal
method forunits
; #51add
deparse_unit
to replaceas_cf
add calender/time conversions between
udunits
time units likeminutes from 1900-0-0
, and R’sPOSIXct
andDate
add
as_units
to replaceas.units
rename
as.dt
toas_difftime
version 0.4-5
CRAN release: 2017-06-14
add support for user-defined unit conversion; #31
allow for 1/n integer powers, as in
set_units(1:10, m^-2) ^ 0.5
; #29properly set log units after log transform; #33
sin
,cos
andtan
no longer complain when units israd
, and returnunitless
; #40now allow for
set_units(1:3, "°C")
and alsoset_units(1:3, "degree_Celsius")
by resolving names to symbols first; #43set_units(x)
withx
numeric sets units tounitless
; #41
version 0.4-4
CRAN release: 2017-04-20
fix a result units bug when multiplying or dividing units vectors of different length, #34
add a
rep
method forunits
vectors