Skip to content

Commit

Permalink
test proper class of argument
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Aug 10, 2023
1 parent a86ee43 commit 3cd552f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions R/udunits.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#' ud_are_convertible(units(a), "km/h")
#' ud_are_convertible("s", "kg")
ud_are_convertible = function(x, y) {
stopifnot(inherits(x, c("character", "symbolic_units")), inherits(y, c("character", "symbolic_units")))
res <- try(R_ut_are_convertible(
R_ut_parse(as.character(x)), R_ut_parse(as.character(y))), silent = TRUE)
! inherits(res, "try-error") && res
Expand Down

0 comments on commit 3cd552f

Please sign in to comment.