# Using Costa Rican ant diversity data from Roth et al. (1994)
data(ants)
# Calculate diversity for each covertype ("col")
shannons(ants[,2:ncol(ants)], ens = TRUE, counts = FALSE, margin = "col")
# Calculate diversity for each species ("row")
ant.div <- shannons(ants[,2:ncol(ants)], ens = TRUE, counts = FALSE,
margin = "row")
row.names(ant.div) <- ants[,1]
ant.div
Run the code above in your browser using DataLab