我正在使用rworldmap
,并且我想将汇总的国家数据绘制为区域。我看到有一些名为mapbyregion
and的函数country2Region
,但如果我理解正确,这些区域是预定义的,例如 Stern 区域。我想使用我自己选择的区域?这可能吗?可以用另一个包完成吗?
我有一个带有 iso3 代码的数据框,我可以在其中说明一个国家所属的地区(我可以对其进行编辑以进行自己的分组。例如,欧盟国家、高收入国家等)。
其中之一应该会有所帮助。
library(leaflet)
library(htmltools)
# example from ?leaflet
m = leaflet() %>% addTiles()
# there are two approaches to the custom css problem
# 1. the easy but less robust way
browsable(
tagList(list(
tags$head(
# you'll need to be very specific
tags$style("p{font-size:200%;}")
# could also use url
#tags$link(href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css",rel="stylesheet")
),
m
))
)
# 2. you can add dependencies to your leaflet map
# this mechanism will smartly handle duplicates
# but carries a little more overhead
str(m$dependencies) # should be null to start
#
m$dependencies <- list(
htmlDependency(
name = "font-awesome"
,version = "4.3.0"
# if local file use file instead of href below
# with an absolute path
,src = c(href="http://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css")
,stylesheet = "font-awesome.min.css"
)
)
m