首页 > 解决方案 > 使用传单进行多个弹出窗口

问题描述

按照此代码制作多个弹出值,显示每个标记的年份、区域、flat_type 和转售价值,但它一直给我这个错误

错误:“闭包”类型的对象不是子集

这是我从代码中遵循的内容,并进行了自己的更改。df指数据集。传单图中有 2 个不同的数据集。

 output$mymap <- renderLeaflet({
    leaflet(data=df()) %>% 
        addTiles() %>% 
        addPolygons(data=adm, weight = 3, fillColor = "white", popup=popup)%>%
        addMarkers(clusterOptions = markerClusterOptions(), popup = paste("Year of Purchase:", df$year, "<br>",
                                                                          "Region", df$region, "<br>",
                                                                          "Flat-Type",df$flat_type,"<br>",
                                                                          "Resale Price:",df$resale_price , "<br>",
                                                                          "Address:", toupper(df$geoAddress)))%>%
        addMarkers(data=mrt,lat = ~lat,lng = ~lon,label=mrt$mrt_station,icon = mrticon)

这是我的数据

 head(headlinedata,1)
    month       town flat_type block      street_name storey_range floor_area_sqm flat_model lease_commence_date resale_price year month1
1 2007-01 ANG MO KIO    5 ROOM   259 ANG MO KIO AVE 2     04 TO 06            135    MODEL A                1982       345000 2007      1
      region                                  address      lat      lon                             geoAddress
1 North_East BLOCK 259 , ANG MO KIO AVE 2 , SINGAPORE 1.368554 103.8316 259 ang mo kio ave 2, singapore 560259

这是我的代码

标签: rshinyleafletreact-leaflet

解决方案


推荐阅读