I am creating a dataframe of different richness in vegan
. I run into trouble with Pielou as I need to log previously created "pumice.richness" data to achieve this result and get error below:
analysis <- function(havreanosim, havre_ANOSIM3.csv)
outfile <- sprintf("%s-analysis.txt", description)
pumice.data<-read.csv("c:\\pumice\\phd\\data_analysis\\havre\\havre_ANOSIM3.csv",header=T)
pumice.locationcode <- pumice.data[, 1:ncol(pumice.data)]
pumice.trop_temp_subtrop <- pumice.data[, 2:ncol(pumice.data)]
pumice.shannon <- specnumber~locationcode(pumice.locationcode, "shannon")
pumice.simpson <- specnumber~locationcode(pumice.locationcode, "simpson")
pumice.richness <- specnumber~locationcode(pumice.locationcode)
pumice.pielou <- pumice.shannon / log(pumice.richness)
Error in log(pumice.richness) :
non-numeric argument to mathematical function
I have tried to convert this to a vector as I thought maybe R read this data as a factor using:
as.numeric(levels(f))[f]
But I could not get a result here and perhaps this is not the problem.