简短版本:执行以下命令时,qtm(countries, "freq")
我收到以下错误消息:
$<-.data.frame
( , " SHAPE_AREAS*tmp*
", value = c(652270.070308042, : 替换有 177 行,数据有 210
免责声明:我已经检查过其他答案,例如this one或this one以及this说明,说明通常此错误来自拼写错误的对象,但找不到我的问题的答案。
可重现的代码:
library(rgdal)
library(dplyr)
library(tmap)
# Load JSON file with countries.
countries = readOGR(dsn = "https://gist.githubusercontent.com/ccamara/fc26d8bb7e777488b446fbaad1e6ea63/raw/a6f69b6c3b4a75b02858e966b9d36c85982cbd32/countries.geojson")
# Load dataframe.
df = read.csv("https://gist.githubusercontent.com/ccamara/fc26d8bb7e777488b446fbaad1e6ea63/raw/754ea37e4aba1b7ed88eaebd2c75fd4afcc54c51/sample-dataframe.csv")
countries@data = left_join(countries@data, df, by = c("iso_a2" = "country_code"))
qtm(countries, "freq")