Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R ggmap-缺少值_R_Ggmap - Fatal编程技术网

R ggmap-缺少值

R ggmap-缺少值,r,ggmap,R,Ggmap,在使用ggmap时,我遇到以下错误:if(is.agree(data)| | empty(data))返回(cbind(data,PANEL=integer(0))时出错: 缺少需要TRUE/FALSE的值 我使用ggmap已经有一段时间了,但是我不知道问题出在哪里——我试着在不同版本的R(3.3.2,3.3.3)上运行它,仍然遇到同样的问题。具有相同空间范围的其他数据集绘图正常 玩具数据集 sub <- structure(list(Lat = c(49.3292885463864, 4

在使用ggmap时,我遇到以下错误:
if(is.agree(data)| | empty(data))返回(cbind(data,PANEL=integer(0))时出错:
缺少需要TRUE/FALSE的值
我使用ggmap已经有一段时间了,但是我不知道问题出在哪里——我试着在不同版本的R(3.3.2,3.3.3)上运行它,仍然遇到同样的问题。具有相同空间范围的其他数据集绘图正常

玩具数据集

sub <- structure(list(Lat = c(49.3292885463864, 49.3316446084215, 
49.3300452342386, 49.3317620975044, 49.3304515659156, 49.3305117886863, 
49.3283736754004, 49.3307167462002, 49.3318995940679, 49.333169419547, 
49.3309562839252, 49.3317698899629, 49.3281374770165, 49.3316554590127, 
49.3326735200194, 49.331519408234, 49.3280156106529, 49.3291709916829, 
49.3328300103323, 49.3306140984074), Lon = c(-117.657207875892, 
-117.672957375133, -117.66331506511, -117.672862630678, -117.66304525751, 
-117.668207331581, -117.655158806988, -117.66229183045, -117.673965605927, 
-117.673707660621, -117.662873110863, -117.673069192809, -117.655568553898, 
-117.674182492008, -117.673907352374, -117.675914855, -117.65485127671, 
-117.657316414995, -117.671748537091, -117.662937333234), z = 
c(9.27369836928302, 2.39183027404169, -1.93395087707449, -3.18890166171755, 
-0.97968656067399, 2.2968631268102, 8.25209737911514, -1.44955530148785, 
-1.16576549902187, 0.341268832113262, -1.15519233610136, 10.2579242298728, 
-4.65813764430002, 0.301315621593428, 5.25169173852741, -5.37463429849591, 
 4.70020657978266, -4.64139357200872, -1.38702225667279, 9.38668592801448)), 
 .Names = c("Lat", "Lon", "z"), row.names = c(266748L, 266749L, 266750L, 
266756L, 266758L, 266760L, 266768L, 266770L, 266771L, 266772L, 266778L, 
266782L, 266783L, 266784L, 266787L, 266791L, 266792L, 266796L, 
266801L, 266802L), class = "data.frame")

sub为什么
base\u层
bit

这对我来说很好:

map <- ggmap(prep, size = c(100, 200), 
             extent='device', darken = 0, legend = "bottom")
map + geom_point(data = sub, aes(x = Lon, y = Lat, colour = z), size = 1)

将需要使用面,这需要基础层,据我所知…我想知道什么时候改变了。ggmap帮助确保听起来您需要用于刻面的基础层!现在才周二,我已经学到了一些东西;-)
map <- ggmap(prep, size = c(100, 200), 
             extent='device', darken = 0, legend = "bottom")
map + geom_point(data = sub, aes(x = Lon, y = Lat, colour = z), size = 1)
sub$facet <- sample(x = 1:4, size = nrow(sub), replace = TRUE)

map2 <- ggmap(ggmap = get_googlemap(maptype = 'satellite',
                                    center = c(-117.660, 49.329), 
                                    zoom = 14)) +
  geom_point(data = sub, aes(x = Lon, y = Lat, colour = z), size = 1) +
  facet_wrap(~ facet, nrow = 2)