使用传单创建地图时出错

时间:2017-07-12 14:41:18

标签: r

我学习使用传单创建其他图层。我成功创建了一个名为“国家公园网站”的图层。但是,当我创建另一个图层时。如下所示有错误。 我的代码是:

 popup_NationalPark<-paste0("<strong>Use Name:</strong>",
                           NationalPark$name,
 "<br><strong>National Park Area (Arces): </strong>",
  NationalPark$`area measured with acres`)

  popup_NationalMonument<-paste0("<strong>Use Name:</strong>",
                          NationalMonument$name,
            "<br><strong>National MonumentDate Established: </strong>",
            NationalMonument$`date established`)
            pal <- colorQuantile("YlOrRd", NULL, n = 9)
  gmap <- leaflet(data = cancermap) %>%
  # Base groups
  addTiles() %>%
  setView(lng = -105, lat = 40, zoom = 4) %>% 
   addPolygons(fillColor = ~pal(rate), 
               fillOpacity = 0.8, 
               color = "#BDBDC3", 
                weight = 1,
                popup = popup_dat,
                group="Cancer Rate/100,000 by Counties") %>% 
   # Overlay groups
    addMarkers(data=LandUse,lat=~lat, lng=~lng, popup=popup_LU, 
    group = "Land Use Sites") %>% 
    addCircleMarkers(data=NationalPark, 
                     lat=~lat, lng=~lng,
                     color = "green",
                     popup = popup_NationalPark,
                     group="National Park Sites")%>% 
   addCircleMarkers(data=NationalMonument,
                     lat=~lat,lng=~lng,
                     color="red",
                     popup= popup_NationalMonument,
                     group="National Monument Sites")%>%                 

            # Layers control
    addLayersControl(
    baseGroups = c("Cancer Rate/100,000 by Counties"),
    overlayGroups = c("Land Use Sites","National Park Sites","National 
    Monument Sites"),
    options = layersControlOptions(collapsed = FALSE)
    )

    gmap

结果是:

 Error in gsub("</", "\\u003c/", payload, fixed = TRUE) : 
 invalid multibyte string at '<99> <48>ome<br><strong>National MonumentDate 
 Established: </strong>7-Jul-00","<strong>Use Name:</strong>Pullman<br>
 <strong>National MonumentDate Established: </strong>19-Feb-15","<strong>Use 
 Name:</strong>Rainbow Bridge<br><strong>National MonumentDate Established: 
 </strong>30-May-10","<strong>Use Name:</strong>R铆o Grande del Norte<br>
 <strong>National MonumentDate Established: </strong>25-Mar-13","<strong>Use 
 Name:</strong>Rose Atoll Marine<br><strong>National MonumentDate 
 Established: </strong>6-Jan-09","<strong>Use Name:</strong>Russell Cave<br>
 <strong>National MonumentDate Established: </strong>11-May-61","<strong>Use 
 Name:</strong>Salinas Pueblo Missions<br><strong>National MonumentDate 
 Established: </strong>1-Nov-09","<strong>Use Name:</strong>San Gabriel 
 Mountains<br><strong>National MonumentDate Established: </strong>10-Oct-
 14","<strong>Use Name:</strong>San Juan Islands<br><strong>National 
 MonumentDate Established: </strong>25-Mar-13","<

我的数据如下:

  > NationalMonument$name
  [1] "Admiralty Island"                       "African Burial Ground"

  [3] "Agate Fossil Beds"                      "Agua Fria"                             
  [5] "Alibates Flint Quarries"                "Aniakchak"                             
  [7] "Aztec Ruins"                            "Bandelier"                             
  [9] "Basin and Range"                        "Bears Ears"                            
  [11] "Belmont-Paul Women's Equality"          "Berryessa Snow Mountain"               
  [13] "Booker T. Washington"                   "Browns Canyon"                         
  [15] "Buck Island Reef"                       "Cabrillo"                              
  [17] "California Coastal"                     "Canyon de Chelly"                      

  [19] "Canyons of the Ancients"                "Cape Krusenstern"                      
  [21] "Capulin Volcano"                        "Carrizo Plain"                         
  [23] "Casa Grande Ruins"                      "Cascade–Siskiyou"                      

  [25] "Castillo de San Marcos"                 "Castle Clinton"                        

  [27] "Castle Mountains"                       "Cedar Breaks"                          
  [29] "César E. Chávez"                        "Charles Young Buffalo Soldiers"        
  [31] "Chimney Rock"                           "Chiricahua"                            
  [33] "Colorado"                               "Craters of the Moon"                   

  [35] "Devils Postpile"                        "Devils Tower"                          
  [37] "Dinosaur"                               "Effigy Mounds"                         
  [39] "El Malpais"                             "El Morro"                              
  [41] "Florissant Fossil Beds"                 "Fort Frederica"                        
  [43] "Fort Matanzas"                          "Fort McHenry"                          

  [45] "Fort Monroe"                            "Fort Ord"                              

  [47] "Fort Pulaski"                           "Fort Stanwix"                          

  [49] "Fort Sumter"                            "Fort Union"                            

  [51] "Fossil Butte"                           "George Washington Birthplace"          
  [53] "George Washington Carver"               "Giant Sequoia"                         

  [55] "Gila Cliff Dwellings"                   "Gold Butte"                            
  [57] "Governors Island"                       "Grand Canyon-Parashant"                
  [59] "Grand Portage"                          "Grand Staircase-Escalante"             

  [61] "Hagerman Fossil Beds"                   "Hanford Reach"                         
  [63] "Hohokam Pima"                           "Homestead"                             
  [65] "Honouliuli"                             "Hovenweep"                             

  [67] "Ironwood Forest"                        "Jewel Cave"                            
  [69] "John Day Fossil Beds"                   "Kasha-Katuwe Tent Rocks"               

  [71] "Katahdin Woods and Waters"              "Lava Beds"                             

  [73] "Little Bighorn Battlefield"             "Marianas Trench Marine"                

  [75] "Military Working Dog Teams"             "Misty Fjords"                          
  [77] "Mojave Trails"                          "Montezuma Castle"                      
  [79] "Mount St. Helens"                       "Muir Woods"                            

  [81] "Natural Bridges"                        "Navajo"                                
  [83] "Newberry"                               "Northeast Canyons and 
  Seamounts Marine"
  [85] "Ocmulgee"                               "Oregon Caves"                          

  [87] "Organ Pipe Cactus"                      "Organ Mountains-Desert Peaks"          
  [89] "Pacific Remote Islands Marine"          "Papahānaumokuākea Marine"              

  [91] "Petroglyph"                             "Pipe Spring"                           
  [93] "Pipestone"                              "Pompeys Pillar"                        

  [95] "Poverty Point"                          "Prehistoric Trackways"                 

  [97] "President Lincoln and Soldiers’ Home"   "Pullman"                               

  [99] "Rainbow Bridge"                         "Río Grande del Norte"                  

 [101] "Rose Atoll Marine"                      "Russell Cave"                          

 [103] "Salinas Pueblo Missions"                "San Gabriel Mountains"                 

 [105] "San Juan Islands"                       "Sand to Snow"                          

 [107] "Santa Rosa and San Jacinto Mountains"   "Scotts Bluff"                          

 [109] "Sonoran Desert"                         "Statue of Liberty"                     

 [111] "Stonewall"                              "Sunset Crater Volcano"                 

 [113] "Timpanogos Cave"                        "Tonto"                                 

 [115] "Tule Springs Fossil Beds"               "Tuzigoot"                              

 [117] "Upper Missouri River Breaks"            "Vermilion Cliffs"                      

 [119] "Virgin Islands Coral Reef"              "Waco Mammoth"                          

 [121] "Walnut Canyon"                          "White Sands"                           

 [123] "World War II Valor in the Pacific"      "Wupatki"                               

 [125] "Yucca House"                           
 > NationalMonument$`date established`
 [1] "1-Dec-78"  "27-Feb-06" "14-Jun-97" "11-Jan-00" "21-Aug-65" "1-Dec-78"  
 "24-Jan-23"
 [8] "11-Feb-16" "10-Jul-15" "28-Dec-16" "12-Apr-16" "10-Jul-15" "2-Apr-56"  
 "19-Feb-15"
 [15] "28-Dec-61" "14-Oct-13" "11-Jan-00" "1-Apr-31"  "9-Jun-00"  "1-Dec-78"  
 "9-Aug-16" 
 [22] "12-Jan-01" "3-Aug-18"  "9-Jun-00"  "15-Oct-24" "12-Aug-46" "12-Feb-
 16" "22-Aug-33"
 [29] "8-Oct-12"  "25-Mar-13" "21-Sep-12" "18-Apr-24" "24-May-11" "2-May-24"  
 "6-Jul-11" 
 [36] "24-Sep-06" "4-Oct-15"  "25-Oct-49" "31-Dec-87" "8-Dec-06"  "20-Aug-
 69" "26-May-36"
 [43] "15-Oct-24" "3-Mar-25"  "1-Nov-11"  "20-Apr-12" "15-Oct-24" "21-Aug-
 35" "28-Apr-48"
 [50] "5-Apr-56"  "23-Oct-72" "23-Jan-30" "14-Jul-43" "15-Apr-00" "16-Nov-
 07" "28-Dec-16"
 [57] "19-Jan-01" "11-Jan-00" "27-Jan-60" "18-Sep-96" "18-Nov-88" "8-Jun-00"  
 "21-Oct-72"
  [64] "19-Mar-36" "19-Feb-15" "2-Mar-23"  "9-Jun-00"  "7-Feb-08"  "26-Oct-
 74" "17-Jan-01"
 [71] "24-Aug-16" "21-Nov-25" "1-Jul-40"  "6-Jan-09"  "28-Oct-13" "1-Dec-78"  
 "12-Feb-16"
 [78] "8-Dec-06"  "27-Aug-82" "9-Jan-08"  "16-Apr-08" "20-Mar-09" "5-Nov-90"  
 "15-Sep-16"
 [85] "23-Dec-36" "12-Jul-09" "13-Apr-37" "21-May-14" "6-Jan-09"  "15-Jun-
 06" "27-Jun-90"
 [92] "31-May-23" "25-Aug-37" "17-Jan-01" "31-Oct-88" "30-Mar-09" "7-Jul-00"  
"19-Feb-15"
 [99] "30-May-10" "25-Mar-13" "6-Jan-09"  "11-May-61" "1-Nov-09"  "10-Oct-
 14" "25-Mar-13"
 [106] "12-Feb-16" "24-Oct-00" "12-Dec-19" "17-Jan-01" "15-Oct-24" "24-Jun-
 16" "30-May-30"
[113] "14-Oct-22" "21-Oct-07" "19-Dec-14" "25-Jul-39" "17-Jan-01" "9-Nov-00"  
"17-Jan-01"
[120] "10-Jul-15" "30-Nov-15" "18-Jan-33" "5-Dec-08"  "9-Dec-24"  "19-Dec-
19"

0 个答案:

没有答案