我正在尝试创建一个带有悬浮文本的小框,该文本具有多行和某些粗体字。我尝试添加'\ n'或'
'分隔符,但最终将它们打印为我的单词之间的字符。我也尝试过
cat(paste(area, status, num, sep = "\n"))
但是当我尝试在地图上实现它时,这只会引起问题。
我希望我的文字看起来像:
Area
**Status:** status
num
现在这就是我所拥有的:
cd_full <- cd_full%>%
mutate(hover = paste(area, paste("Status:", status), num, sep = "\n")
leaflet() %>%
addPolygons(data = subset(cd_full, color == "green"), opacity= 2, weight=2, color = "Green" , group = "Green",
label = ~hover, highlightOptions = list(bringToFront = TRUE)) %>%
addPolygons(data = subset(cd_full, color == "yellow" ), opacity=.5, weight=.4, color = "Yellow",
label = ~hover, group = "yellow")
但是它们都结束于同一行。谢谢