Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.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的传单中,我无法复制一个说明图标如何工作的标准示例_R_Url_Hyperlink_Leaflet_Icons - Fatal编程技术网

在R的传单中,我无法复制一个说明图标如何工作的标准示例

在R的传单中,我无法复制一个说明图标如何工作的标准示例,r,url,hyperlink,leaflet,icons,R,Url,Hyperlink,Leaflet,Icons,这是一个比较常见的传单例子。但当我运行这段代码时,我在海洋中或我的图例中看不到红叶和绿叶图标,我看到的是带问号的蓝色正方形。不过背景图是正确的 library(leaflet) # Sample Data data(quakes) quakes <- quakes[1:10,] # Choose Icon: leafIcons <- icons( iconUrl = ifelse(quakes$mag < 4.6, "http://

这是一个比较常见的传单例子。但当我运行这段代码时,我在海洋中或我的图例中看不到红叶和绿叶图标,我看到的是带问号的蓝色正方形。不过背景图是正确的

library(leaflet)

# Sample Data
data(quakes)
quakes <- quakes[1:10,]

# Choose Icon:
leafIcons <- icons(
  iconUrl = ifelse(quakes$mag < 4.6,
                   "http://leafletjs.com/docs/images/leaf-green.png",
                   "http://leafletjs.com/docs/images/leaf-red.png"
  ),
  iconWidth = 38, iconHeight = 95,
  iconAnchorX = 22, iconAnchorY = 94)

html_legend <- "<img src='http://leafletjs.com/docs/images/leaf-green.png'>green<br/>
<img src='http://leafletjs.com/docs/images/leaf-red.png'>red"

# Produce Map:
leaflet(data = quakes) %>% addTiles() %>%
  addMarkers(~long, ~lat, icon = leafIcons) %>%
  addControl(html = html_legend, position = "bottomleft")
图书馆(传单)
#样本数据
数据(地震)
地震%
addMarkers(~long,~lat,icon=leafcicons)%>%
addControl(html=html\u图例,position=“bottomleft”)

我试过了,得到了一个图例,上面有破碎的符号,地图上没有地震地点的标记。搜索提供了错误404(未找到文件)以及关于在github上查找它的注释。错误可能是由于在不更新包的情况下更改了文件位置。嗯,这很简单。您找到文件的新位置了吗?没有,但由于任何图标都可以,所以只需将这些图标替换为其他图标即可。