Skip to content

Commit

Permalink
raise error if scale_type is called when units is not attached
Browse files Browse the repository at this point in the history
  • Loading branch information
Enchufa2 committed Dec 28, 2021
1 parent 4d423b7 commit 9ec86ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/scale_units.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,9 @@ MakeScaleContinuousPositionUnits <- function() {
}

# registered in .onLoad()
scale_type.units <- function(x) c("units", "continuous")
scale_type.units <- function(x) {
if (!"units" %in% .packages())
stop("Variable of class 'units' found, but 'units' package is not attached.\n",
" Please, attach it using 'library(units)' to properly show scales with units.")
c("units", "continuous")
}

0 comments on commit 9ec86ee

Please sign in to comment.