Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R:在shapefile中查找/匹配螺母代码_R_Shapefile_Sp_Rgdal_Maptools - Fatal编程技术网

R:在shapefile中查找/匹配螺母代码

R:在shapefile中查找/匹配螺母代码,r,shapefile,sp,rgdal,maptools,R,Shapefile,Sp,Rgdal,Maptools,在R中的shapefile中哪里可以找到EU NUTS代码 NUTS=区域统计单位的命名法 每个螺母区域都有一个螺母代码: 您还可以在中找到详细的NUTS代码 当我下载NUTS shapefile时,我找不到这个NUTS代码 我从以下网站下载了shapefileNUTS_2013_2000_SH.zip: ec.europa.eu/eurostat/web/gisco/geodata/参考数据/行政单位统计单位/nuts#nuts13 下载后,我使用以下代码将shapefile上载到R中: l

在R中的shapefile中哪里可以找到EU NUTS代码

NUTS=区域统计单位的命名法

每个螺母区域都有一个螺母代码:

您还可以在中找到详细的NUTS代码

当我下载NUTS shapefile时,我找不到这个NUTS代码

我从以下网站下载了shapefileNUTS_2013_2000_SH.zip

ec.europa.eu/eurostat/web/gisco/geodata/参考数据/行政单位统计单位/nuts#nuts13

下载后,我使用以下代码将shapefile上载到R中:

library(sp)
library(rgdal)

dir <- setwd(getwd())

NUTS_shape = readOGR(dsn = (dsn = "~/NUTS_2013_20M_SH/data", layer = "NUTS_BN_20M_2013")
NUTS_shape = readOGR(dsn = (dsn = "~/NUTS_2013_20M_SH/data", layer = "NUTS_RG_20M_2013")
库(sp)
图书馆(rgdal)
dir我找到了答案:

如果有人也在处理NUTS数据,那么您将发现NUTS代码不在层“NUTS_BN_20M_2013”中,但您必须使用另一层,即:“NUTS_RG_20M_2013”

因此,请使用以下代码:

library(sp)
library(rgdal)

dir <- setwd(getwd())

NUTS_shape = readOGR(dsn = (dsn = "~/NUTS_2013_20M_SH/data", layer = "NUTS_BN_20M_2013")
NUTS_shape = readOGR(dsn = (dsn = "~/NUTS_2013_20M_SH/data", layer = "NUTS_RG_20M_2013")
然后如果你写
NUTS_shape@data
您可以得到:

  NUTS_ID STAT_LEVL_  SHAPE_AREA SHAPE_LEN
0      AT          0 10.04269653 22.922441
1     AT1          1  2.84477225 10.876468
2    AT11          2  0.47903755  5.591853
3   AT111          3  0.08480488  1.178272
4   AT112          3  0.21836213  2.649698
5   AT113          3  0.17587054  2.276286
螺母ID等于代码。

我找到了答案:

如果有人也在处理NUTS数据,那么您将发现NUTS代码不在层“NUTS_BN_20M_2013”中,但您必须使用另一层,即:“NUTS_RG_20M_2013”

因此,请使用以下代码:

library(sp)
library(rgdal)

dir <- setwd(getwd())

NUTS_shape = readOGR(dsn = (dsn = "~/NUTS_2013_20M_SH/data", layer = "NUTS_BN_20M_2013")
NUTS_shape = readOGR(dsn = (dsn = "~/NUTS_2013_20M_SH/data", layer = "NUTS_RG_20M_2013")
然后如果你写
NUTS_shape@data
您可以得到:

  NUTS_ID STAT_LEVL_  SHAPE_AREA SHAPE_LEN
0      AT          0 10.04269653 22.922441
1     AT1          1  2.84477225 10.876468
2    AT11          2  0.47903755  5.591853
3   AT111          3  0.08480488  1.178272
4   AT112          3  0.21836213  2.649698
5   AT113          3  0.17587054  2.276286

NUTS_ID等于代码。

最好至少得到一条评论,而不是“-1”评级。否则,我不知道你对我的问题有什么不喜欢的地方。如果能得到至少一条评论而不是“-1”评级,那就好了。否则,我不知道你为什么不喜欢我的问题。