install.packages('vegan') library(vegan) x <- c(2, 6, 158, 87, 2, 7, 1, 20, 19, 93, 2, 211, 240) #podenky lokality HLU2 Shannon1 <- diversity(x, index = "shannon", MARGIN = 1, base = exp(1)) #shannon index diverzity s prirodzenym logaritmom; mozeme pouzit aj index = "simpson" Shannon2 <- diversity(x, index = "shannon", MARGIN = 1, base = 2) #shannon index diverzity s logaritmom pri zaklade 2 Shannon1 [1] 1.791299 Shannon2 [1] 2.584299 vtaky <- read.csv("c:/DANKA HLAVNY ADRESAR/Vyuka/Bi5980 Biodiverzita/Biodiverzita vyuka 2015/03_2015_data.csv",sep=";",dec=",", header=T) vtaky head(vtaky) tail(vtaky) attach(vtaky) Shannon1 <- diversity(X2001, index = "shannon", MARGIN = 1, base = exp(1)) Shannon1 [1] 2.621192 S <- specnumber(X2001) ## rowSums(X2001 > 0) does the same... J <- Shannon1/log(S) ----------------------------------------------- rarefy Rarefaction Species Richness S <- specnumber(X1996) # observed number of species (raremax <- min(rowSums(X1996))) # ??? preco mi toto nechce spocitat? Srare <- rarefy(X1996, raremax) plot(S, Srare, xlab = "Observed No. of Species", ylab = "Rarefied No. of Species") abline(0, 1) rarecurve(X1996, step = 20, sample = raremax, col = "blue", cex = 0.6) ???? niekde je chyba ???