Quero usar o fortify
没有seguintecódigo例子:
Brasil <- fortify(BRmap, region = "BRmap@data$GID_2") %>%
mutate(id = as.integer(id)) %>%
full_join(BRmap@data, by =c("id" = "BRmap@data$GID_2")) %>%
select(c(id, long, lat, order, hole, piece, group, NAME_2))
BRmap
éumfileshape retirado do site https://gadm.org
答案 0 :(得分:0)
也许试试这个?
by
参数需要一个字符/列表,而不是整数,因此mutate应该是mutate(id = as.character(id))
。Brasil <- fortify(BRmap, region = "GID_2") %>%
mutate(id = as.character(id)) %>%
full_join(BRmap@data, by =c("id" = "GID_2")) %>%
select(c(id, long, lat, order, hole, piece, group, NAME_2))