Skip to content

Commit

Permalink
fix compatibility with upcoming units 0.7-0
Browse files Browse the repository at this point in the history
  • Loading branch information
Enchufa2 committed Feb 21, 2021
1 parent fb24ea7 commit e99957e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: constants
Type: Package
Title: Reference on Constants, Units and Uncertainty
Version: 1.0.0
Version: 1.0.1
Authors@R: c(
person("Iñaki", "Ucar", email="iucar@fedoraproject.org",
role=c("aut", "cph", "cre"), comment=c(ORCID="0000-0001-6403-5550")))
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# constants 1.0.1

- Fix compatibility with `units` 0.7-0.

# constants 1.0.0

Update to version 8.1, the 2018 CODATA recommended values (#7 addressing #6).
Expand Down
9 changes: 7 additions & 2 deletions R/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,13 @@ set_correlations <- function() {

if (requireNamespace("units", quietly = TRUE)) {
# define the speed of light
try(units::remove_symbolic_unit("c"), silent=TRUE)
units::install_conversion_constant("c", "m/s", syms$c0)
if (utils::packageVersion("units") < "0.7-0") {
try(units::remove_symbolic_unit("c"), silent=TRUE)
units::install_conversion_constant("c", "m/s", syms$c0)
} else {
units::remove_unit("c")
units::install_unit("c", paste(syms$c0, "m/s"))
}

syms_with_units <<- Map(
units::set_units, syms, constants::codata$unit, mode="standard")
Expand Down

0 comments on commit e99957e

Please sign in to comment.