library(vegan)
data(varespec)
# A partial set of observations from a single plot for a Scandinavian moss/vascular plant/lichen survey.
site18<-data.frame(t(varespec[1,][1:20]))
#Shannon-Weiner diversity
SW<-function(data){
d<-data[data!=0]
p<-d/sum(d)
-1*sum(p*log(p))
}
pv<-pseudo.v(site18,SW)
Run the code above in your browser using DataLab