chaizongzheng的个人博客分享 http://blog.sciencenet.cn/u/chaizongzheng

博文

A R function to calculate the McIntosh diversity index

已有 2698 次阅读 2015-11-29 09:03 |个人分类:R software|系统分类:科研笔记| The, function, diversity, calculate, McIntosh

  • Formula as follow:


where Dm is McIntosh diversity index,N is the total number of individuals in the plant population,

Ni is the number of individuals of the ith species.

  • R function as follow:

#A R function for calculating the mcIntosh diversity index

mcIntosh<-function(x,MARGIN = 1){

 x <- drop(as.matrix(x))

 if (length(dim(x)) > 1) {

   total <- apply(x, MARGIN, sum)

   Dm<-(total-(rowSums(x^2))^0.5)/(total-total^0.5)

 }

 else {

   Dm <- (sum(x)-(sum(x^2))^0.5)/(sum(x)-sum(x)^0.5)}

 return(Dm)

}





https://blog.sciencenet.cn/blog-1366577-939553.html

上一篇:基于R语言的林分空间结构分析中的边缘校正
下一篇:森林空间结构分析的一组案例数据。
收藏 IP: 113.200.245.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-18 22:59

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部