这是我的程序:
library(sp)
library(RColorBrewer)
#get spatial data for Spain on region level
con <- url("http://gadm.org/data/rda/ESP_adm1.RData")
print(load(con))
close(con)
# plot Spain with colors
col = c("blue","blue","blue","blue","blue","blue","blue","blue","blue",
"blue","blue","blue","blue","blue","blue","blue","red","red")
spplot(gadm, "NAME_1", col.regions=col, main="Regiones de España",
colorkey=F, lwd=.4, col="black")
我跑步时得到的是我正在寻找的东西,但我想改变西南部的岛屿(加那利群岛),使其更接近西班牙国家。我不知道该怎么做才能改变岛屿的坐标。我只知道他们在这里:
gadm[14,]
例如,我尝试在此处进行更改:
gadm[14,]@polygons[[1]]@Polygons[[1]]@coords
但我收到消息:no method for coercing this S4 class to a vector