Skip to content

Commit

Permalink
close #1: use as_units instead of parse_unit [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
Enchufa2 committed Jan 8, 2018
1 parent 8f5b35f commit 1a325a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ URL: https://github.com/r-quantities/constants
BugReports: https://github.com/r-quantities/constants/issues
Depends:
R (>= 3.0.0)
Imports:
utils
Suggests:
errors,
units,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2017
YEAR: 2017-2018
COPYRIGHT HOLDER: Iñaki Ucar
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# constants 0.0.1.9000

## Minor changes and fixes:

* Use `units::as_units()` instead of the deprecated `units::parse_unit()` (#1).
6 changes: 5 additions & 1 deletion R/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ syms_with_units <- NULL
}

if (requireNamespace("units", quietly = TRUE)) {
if (utils::packageVersion("units") < "0.5.0")
parse_unit <- units::parse_unit
else parse_unit <- units::as_units

syms_with_units <<- syms
for (i in seq_along(syms))
units(syms_with_units[[i]]) <<- units::parse_unit(constants::codata$unit[[i]])
units(syms_with_units[[i]]) <<- parse_unit(constants::codata$unit[[i]])
}
}

Expand Down

0 comments on commit 1a325a5

Please sign in to comment.