我想在 tmaps 中添加两个国家/地区标签及其各自的数据。我知道 tm_text 允许我添加这样的标签(我知道输出看起来很糟糕,但只是为了说明):
data("World")
tm_shape(World)+
tm_borders()+
tm_fill("HPI",
palette = "Blues")+
tm_text("pop_est")
我希望每个标签都是这样的:“国家名称”“:”“变量”。我尝试使用 paste0:
tm_shape(World)+
tm_borders()+
tm_fill("HPI",
palette = "Blues")+
tm_text(paste0("pop_est", ":", "HPI"))
Error: Incorrect data variable used for the text
有人知道该怎么做吗?提前致谢!