I have information for the observers that have surveyed locations in a given habitat, and of course the species they saw and the locations they conducted the surveys at.

I am interpreting the observer as a species and their abundance is measured as the number of minutes they spend or the number of surveys they conduct. The Location is treated similarly. The species I am treating the abundance as the number of surveys they showed up in, though I could also sum the number of individuals when the count data is collected. I opted for counting the number of surveys the bird was seen in here, because not everyone counts the individuals and there is more data when you use the presence absence.

I created a function (effectivespecies) to find the effective number of equally abundant species when shannon’s diversity is calculated. basically exp(shannon’s Diversity(community)) .

I could do this,

exp(diversity(ObsMinutesInHabitat$Water))#Shannon’s diversity
exp(diversity(ObsMinutesInHabitat$Pine))#Shannon’s diversity
exp(diversity(ObsMinutesInHabitat$Wetland))#Shannon’s diversity
exp(diversity(ObsMinutesInHabitat$Sand))#Shannon’s diversity
exp(diversity(ObsMinutesInHabitat$Urban))#Shannon’s diversity
exp(diversity(ObsMinutesInHabitat$Grass))#Shannon’s diversity
exp(diversity(ObsMinutesInHabitat$HWTC))#Shannon’s diversity

WHich gives me this
> exp(diversity(ObsMinutesInHabitat$Water))#Shannon’s diversity
[1] 7.8
> exp(diversity(ObsMinutesInHabitat$Pine))#Shannon’s diversity
[1] 40
> exp(diversity(ObsMinutesInHabitat$Wetland))#Shannon’s diversity
[1] 24
> exp(diversity(ObsMinutesInHabitat$Sand))#Shannon’s diversity
[1] 26
> exp(diversity(ObsMinutesInHabitat$Urban))#Shannon’s diversity
[1] 26
> exp(diversity(ObsMinutesInHabitat$Grass))#Shannon’s diversity
[1] 32

but I instead created a function

##create effective number of species function####
effectivesps <- function(x) #This function works on a data frame x using whichever other function you select
{
exp(diversity(x))
}

and used colwise ##column-wise application of a function over a dataframe

> colwise(effectivesps)(ObsMinutesInHabitat[,2:8])
Water Pine Wetland Sand Urban Grass HWTC
1 7.8 40 24 26 26 32 6.4

Me Likey