Closed dmurdoch closed 8 months ago
Example:
reprex::reprex({ library(ggmap) library(ggplot2) ggmap(get_map(), base_layer = ggplot()) }, si = TRUE)
This example generates a warning if you run it:
Warning message: In missing(base_layer) || base_layer == "auto" : 'length(x) = 9 > 1' in coercion to 'logical(1)'
The problem is with the test base_layer == "auto". Since base_layer is a ggplot object, it's a list of length 9, and so that test fails.
base_layer == "auto"
base_layer
ggplot
A fix for this is to use
missing(base_layer || identical(base_layer, "auto")
or perhaps
missing(base_layer) || (is.character(base_layer) && length(base_layer) == 1) && base_layer == "auto")
instead. (The second test is a bit more lenient: the argument could have names or other attributes and still pass.)
A workaround that ggvoronoi has adopted (https://github.com/garretrc/ggvoronoi/pull/16) is to use inset_ggmap instead of the base_layer argument to ggmap().
ggvoronoi
inset_ggmap
ggmap()
Reproducible Example
Example:
This example generates a warning if you run it:
The problem is with the test
base_layer == "auto"
. Sincebase_layer
is aggplot
object, it's a list of length 9, and so that test fails.A fix for this is to use
or perhaps
instead. (The second test is a bit more lenient: the argument could have names or other attributes and still pass.)