所有善良的灵魂,都需要帮助。我正在创建传单地图,无法解决标签的奇怪问题。我创建了带有很少变量的标签,如果第一个变量是数字,则标签呈现正常,但如果第一个变量是字符串,则它们会失败 - 知道问题是什么吗?让我们从一个虚拟的 spdf 开始:
library(htmltools)
library(sp)
library(leaflet)
df <- new("SpatialPointsDataFrame", data = structure(list(PMID = c(184397, 184397), SPACEID = c("184397_1", "184397_2")), .Names = c("PMID", "SPACEID"), row.names = 1:2, class = "data.frame"), coords.nrs = numeric(0), coords = structure(c(-0.14463936, -0.14468822, 51.50726534, 51.50730171), .Dim = c(2L, 2L), .Dimnames = list(c("1", "2"), c("x", "y"))), bbox = structure(c(-0.14468822, 51.50726534, -0.14463936, 51.50730171), .Dim = c(2L, 2L), .Dimnames = list(c("x", "y"), c("min", "max"))), proj4string = new("CRS", projargs = "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"))
Run Code Online (Sandbox Code Playgroud)
现在我们(m)应用一个简单的 HTML 行(原来使用 df …