ZonalStat(SDMTools)
ZonalStat()所属R语言包:SDMTools
Landscape Zonal Statistics
景观分区统计
译者:生物统计家园网 机器人LoveR
描述----------Description----------
ZonalStat calculates the statistics of data for specified zones of two matrices of data. The matrix can be a raster of class 'asc' (adehabitat package), 'RasterLayer' (raster package) or 'SpatialGridDataFrame' (sp package).
ZonalStat计算两个矩阵的数据为指定的区域的数据的统计信息。该基质可以是类递增(adehabitat包),的RasterLayer(栅格包)或的SpatialGridDataFrame(藻包)的栅格。
用法----------Usage----------
ZonalStat(mat,zones,FUN='all')
参数----------Arguments----------
参数:mat
a matrix of data to be summarized; The matrix can be a raster of class 'asc' (adehabitat package), 'RasterLayer' (raster package) or 'SpatialGridDataFrame' (sp package)
要汇总的数据的矩阵,该矩阵可以是一个栅格类递增(adehabitat包),的RasterLayer(栅格包)或SpatialGridDataFrame(藻封装)
参数:zones
a matrix of data with individual patches identified as with ConnCompLabel; The matrix must be of the same size & extent as mat
矩阵数据的个别修补软件认定为与ConnCompLabel;矩阵必须是相同的大小及程度mat
参数:FUN
a single or vector of functions to be applied to each 'zone'; the default of 'all' will calculate min, 1st quarter, median, 3rd quarter, max, mean, standard deviation and n
一个单一的或向量的功能被应用到每一个“区域”,默认的“所有”将计算分,第一季度,中位数,第三季度,最大,平均值,标准偏差和n
Details
详细信息----------Details----------
The code summarizes the data for defined zones. Nearly any function can be used for summarizing the data. <br> <br> The FUN defined with 'all' as one of or the only function will append the functions of min, 1st quarter, median, 3rd quarter, max, mean, standard deviation and n to what is being calculated.
汇总数据的代码定义的区域。总结的数据可用于几乎任何函数。参考参考定义为“所有”的乐趣为一体的或唯一的功能将附加分,第一季度,中位数,第三季度,最大值,平均值,标准偏差和n的函数的计算。
值----------Value----------
a data.frame listing
数据框上市
参数:zone
the unique ID for each zone.
为每个区域的唯一ID。
参数:functions...
a column for each of the functions identified
每个的功能确定的列
The data.frame will have an atribute defining the number of NA values that were excluded from the analysis.
数据框将有一个属性约定义的NA值的数目,从分析中排除。
(作者)----------Author(s)----------
Jeremy VanDerWal <a href="mailto:jjvanderwal@gmail.com">jjvanderwal@gmail.com</a>
实例----------Examples----------
#define a simple binary matrix[定义一个简单的二进制矩阵]
tmat = { matrix(c( 0,0,0,1,0,0,1,1,0,1,
0,0,1,0,1,0,0,0,0,0,
0,1,NA,1,0,1,0,0,0,1,
1,0,1,1,1,0,1,0,0,1,
0,1,0,1,0,1,0,0,0,1,
0,0,1,0,1,0,0,1,1,0,
1,0,0,1,0,0,1,0,0,1,
0,1,0,0,0,1,0,0,0,1,
0,0,1,1,1,0,0,0,0,1,
1,1,1,0,0,0,0,0,0,1),nr=10,byrow=TRUE) }
#do the connected component labelling[做连接的组件标签]
ccl.mat = ConnCompLabel(tmat)
ccl.mat #this is the zone matrix to be used[这是要使用的区域矩阵]
#create a random data matrix[创建一个随机的数据矩阵]
data.mat = matrix(runif(100),nr=10,nc=10)
data.mat
#calculate the zonal statistics[计算分区统计]
zs.data = ZonalStat(data.mat,ccl.mat,FUN='all')
zs.data
#just calculate the sum[只是计算总和]
zs.data = ZonalStat(data.mat,ccl.mat,FUN='sum')
zs.data
#calculate sum & n & 'all' and show when a function is not defined[计算&N&所有,当一个函数没有定义]
zs.data = ZonalStat(data.mat,ccl.mat,
FUN=c('sum','length','not.a.function','all'))
zs.data
attr(zs.data,'excluded NAs') #show how many NAs were omitted from analysis[显示许多NAS遗漏分析]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|