i have a data frame where each row represent a community with number of species and number of individuals:
n.species<- c(3,5,10,15,20)
n.indiv <- c(30, 40, 50, 100, 200, 300, 500, 750, 1000)
n.indiv <- rep(n.indiv, each = length(S))
df <- data.frame(S = rep(S, length(n.indiv) / length(S)), n.indiv)
df$margalef <- (df$S-1)/(log(df$n.indiv))
print(df)
i would like to calculate the integral of margalef (df$S-1)/(log(df$n.indiv)) against n.indiv for each row.
how do i do it?
thanks in advance
1