joinData2Map(rworldmap)
joinData2Map()所属R语言包:rworldmap
Joins user polygon attribute data to a map
加入用户的多边形属性数据图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Joins user polygon attribute data to a map of polygon boundaries. The map can either be one stored in the package or provided by the user. Returns a spatialPolygonsDataFrame ready for plotting using mapPolys. Reports join successes and failures.
加入用户的多边形属性数据到图的多边形边界。该图可以被存储在包中或由用户提供。一个spatialPolygonsDataFrame返回准备使用mapPolys的图。报告加入成功经验和失败教训。
用法----------Usage----------
joinData2Map(dF
, nameMap = ""
, nameJoinIDMap = "ISO3"
, nameJoinColumnData = "ISO3V10"
, nameNameColumnData = "Country"
, suggestForFailedCodes = FALSE
, projection="none"
, mapResolution="low"
, verbose = FALSE
)
参数----------Arguments----------
参数:dF
R data frame with at least one column of polygon IDs and one column of data
R的数据框的多边形的ID中的至少一个列的一列数据
参数:nameMap
the map to join the attribute data too
在图上加入的属性数据
参数:nameJoinIDMap
the name of the joinIDs in the map
名称在图joinIDs的
参数:nameJoinColumnData
name of column in the data containing country referencing
国家参照的数据列名
参数:nameNameColumnData
optional name of column in the data containing polygon names (used in reporting of success/failure)
的列中的数据包含多边形的名称(用于报告的成功/失败)的可选的名字
参数:suggestForFailedCodes
NOT YET ENABLED T/F whether you want system to suggest for failed codes
尚未启用T / F失败的代码是否希望系统建议
参数:projection
which map projection to use, options 'none', 'EqualArea' latter uses Mollweide
使用图投影,选择没有,EqualArea后者使用Mollweide的
参数:mapResolution
resolution of the borders in the internal map, only for projection='none' : options 'low', 'medium'
边界的内部图,只为投影分辨率=没有选项“低”,“中等”
参数:verbose
if set to FALSE progress messages to console are restricted
如果设置为FALSE进度消息来安慰限制
Details
详细信息----------Details----------
Joins user polygon attribute data provided in a 'data frame' to a map of polygon boundaries. The map can either be one stored in the package or provided by the user. Returns a spatialPolygonsDataFrame ready for plotting using mapPolys. Reports join successes and failures.
加入用户的多边形属性提供的数据,在一个数据框的多边形边界图。该图可以被存储在包中或由用户提供。一个spatialPolygonsDataFrame返回准备使用mapPolys的图。报告加入成功经验和失败教训。
The user specifies the name of the column in their data containing polygon referencing.
用户指定的名称,它们的数据列中含有多边形引用的。
The user can choose from different internal map resolutions and projections. Uses the function getMap to retrieve the map.
用户可以选择从不同的内部图的决议和预测。使用getMap的功能来检索图。
值----------Value----------
An R 'SpatialPolygonsDataFrame' [package "sp"] object with the data joined to it
一个RSpatialPolygonsDataFrame“[包”SP“的数据对象加入到
(作者)----------Author(s)----------
andy south
参见----------See Also----------
mapPolys, getMap
mapPolys,getMap
实例----------Examples----------
## this example uses downloaded files[#本例中使用下载的文件]
## to run it download the files[#运行下载的文件]
## and remove the comment symbols '#' from all the lines starting with a single '#'[#和删除注释符号#开始的行与一个单一的#]
## US states map downloaded from :[#美国的图下载:]
## http://www2.census.gov/cgi-bin/shapefiles2009/national-files[#http://www2.census.gov/cgi-bin/shapefiles2009/national-files]
#inFile <- 'tl_2009_us_stateec.shp'[INFILE < - tl_2009_us_stateec.shp的]
#sPDF <- readShapePoly(inFile)[SPDF < - readShapePoly(是Infile)]
#str(sPDF@data)[STR(SPDF数据)]
##################[#################]
## use mapPolys to map the sPDF[#使用mapPolys映射SPDF]
#mapPolys(sPDF,nameColumnToPlot = "ALANDEC")[mapPolys(SPDF“,nameColumnToPlot”ALANDEC“)]
#mapPolys(sPDF,nameColumnToPlot = "AWATEREC",mapRegion='North America')[mapPolys(SPDF,nameColumnToPlot =“AWATEREC”,北美的MapRegion =)]
##################[#################]
## join some other data to it[加入一些其他的数据]
## education data downloaded from here as xls then saved as csv[#教育从这里下载为XLS格式的数据,然后保存为CSV]
## http://nces.ed.gov/ccd/drpcompstatelvl.asp[#http://nces.ed.gov/ccd/drpcompstatelvl.asp]
#dataFile <- 'SDR071A_xls.csv'[数据文件< - “SDR071A_xls.csv”的]
#dF <- read.csv(dataFile,as.is=TRUE)[DF < - read.csv(DATAFILE,as.is TRUE)]
#str(dF)[STR(DF)]
## STATENAME[#STATENAME]
## DRP912 Dropout Rate, Grades 9 through 12[DRP912 9到12年级辍学率,]
## joining the data to the map[#加入数据的图]
## based upon state names (column NAMEEC in map, and STATENAME in the data)[#根据国家名(列NAMEEC图,STATENAME的数据中)]
#sPDF2 <- joinData2Map(dF[sPDF2 < - joinData2Map(DF]
# , nameMap = sPDF[nameMap = SPDF]
# , nameJoinIDMap = "NAMEEC"[,nameJoinIDMap =“NAMEEC”]
# , nameJoinColumnData = "STATENAME")[nameJoinColumnData =“STATENAME”)]
#################[################]
## plot one of the attribute variables[#图的属性变量]
#mapDevice()# to set nice shape map window[mapDevice()#设置造型美观大方图窗口]
#mapPolys(sPDF2,nameColumnToPlot = "DRP912",mapRegion='North America')[mapPolys(sPDF2,nameColumnToPlot =“DRP912”,北美的MapRegion =)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|