Skip to content

Commit cd0395d

Browse files
committed
Better check for numeric values
1 parent ada24ba commit cd0395d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Version 0.3.0.9000
22
------------------------------------------------------------------------------
33

4+
* `scale_continuous()` uses a more correct check for numeric values.
5+
46
* NaN is correctly recognised as a missing value by the gradient palettes
57
(ggplot2#1482).
68

R/scale-continuous.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cscale <- function(x, palette, na.value = NA_real_, trans = identity_trans()) {
3535
train_continuous <- function(new, existing = NULL) {
3636
if (is.null(new)) return(existing)
3737

38-
if (!is.numeric(new)) {
38+
if (!typeof(new) %in% c("integer", "double")) {
3939
stop("Discrete value supplied to continuous scale", call. = FALSE)
4040
}
4141
suppressWarnings(range(existing, new, na.rm = TRUE, finite = TRUE))

0 commit comments

Comments
 (0)