beespeciesdata <-read.csv("bee data averages.csv")
## Bee abundance - plot abundance for each of the 10 species across the 4 plots ##
# summarise the data
bee_abundance <-beespeciesdata %>%
# remove N/A in species column
filter(Bee_species!="N/A") %>%
# group the data by species, plot and day
group_by(Bee_species, Plot, Day) %>%
# calculate the sum of counts per species
summarise(count = length(Bee_species)) %>%
ungroup()
bee_abundance
# Comparing abundance - boxplot
abund.plot <- ggplot(bee_abundance, aes(x = as.factor(Plot), y = count, colour = Plot))+
geom_boxplot()+
facet_wrap(~Bee_species)+
labs(y="Number of individuals", x="Plot")+
theme_bw()
abund.plot
# richness
bee_richness <-beespeciesdata %>%
# remove N/A in species column
filter(Bee_species!="N/A") %>%
# group the data by species, plot
group_by(Bee_species, Plot) %>%
tally() %>%
ungroup()
bee_richness
# Comparing richness - boxplot
richness.plot <- ggplot(bee_richness, aes(x = as.factor(Plot), y = n, color = Plot))+
geom_boxplot()+
labs(y="Number of bee species", x="Plot")+
theme_bw()
richness.plot
d <- column_to_rownames(data, var = "Bee_species") # converts the "Species" column to rownames
head(d)
rarefac <- iNEXT(d[,1:3], q=c(0,1,2), datatype = "bee_abundance") # q-values: 0 = richness, 1 = Shannon, 2 = Simpson
rarefac
rarefac.plot <- ggiNEXT(rarefac,facet.var = "order")+
theme_bw(base_size = 14) +
theme(legend.position="bottom",
legend.title=element_blank())
rarefac.plot
i have got the abundance and the species richness plot to work so im trying do a rarefac curve which will show me the Species richness
Shannon diversity index
Simpson Diversity
according to your code rarefac is an object you attempted to make with some function called iNEXT.
It will not be found if that iNEXT function call had an error
Perhaps you are making a mistake of reading the R console log in the wrong order, when addressing issues, its incorrect to go from bottom up, rather should read down from top to bottom.
You should identify the first error issue that arises in your log as you submit the statements in your script line by line. (the later parts of your script wont work if the earlier parts haven't)
If you want specific help, it will require a reprex
hey like i stated i have got the species richness and abundance plots to work and it reads my data set etc , all the write packages were downloaded first and how do i get specific help as non of my lectuers are getting back to me ?
we don't have beespeciesdata, and would need it to run your code and understand what is the problem.
It simply doesnt make sense that your object is not found, if it was succesfully made so I'm sceptical...
I provided you a link to a guide of how you can share it for the forum.
i have tried to produce a reprex for beginners and created the dataset but i dont know where it as disappeared to is there not a way where i can private message one of you guy so i can send my actually r studio file, my head is totally mashed atm