@@Riffomonas I have code question: my csv (Species.csv) is set up with the first column is Sample 1-520, and my columns after this are 125 plant codes with percent cover (ADBI .5, 1, 0, ....; ANDE 1, 0, .5,....). When I ran the vegan code for richness with specnumber(Species), I noticed I had one value of richness extra than when I calculated it with excel. I tried selecting only the species columns, specnumber(Species[2:126]) , and this worked but when I follow this same logic with my other indices of shannon diversity and evenness it changes things pretty drastically. So I'm wondering-- is it necessary to omit a label column such as Sample # so it's not used in the calculations, or does it not work this way? Any advice would be helpful-- I'm spending too much time on this quandary 😅 Thanks! Molly
@@mollycribari7750 Thanks for the question. specnumber expects a matrix with rownames rather than having the rownames in a column like we do with tibbles. It basically does rowSum(Species > 0)
Great content! Could you show a video on how to incorporate the rarefied data from your previous videos into plotting alpha diversity to compare it to non-rarefied data?
Thanks Michael - I do this a few times over the series on rarefaction. Non rarefied data are more variable, larger and produce spurious significant differences more often when effects are confounded with sampling effort
@@efratsharon1294 I second this, specifically how to run an ANOVA that shows whether the groups you were analyzing for the first 10 minutes of this video have a statistically significant difference in their alpha diversity values
Thank you so much Sir for your awesome video! Could you show us Generalized additive model using mgcv package with interpretation using a data contain both continues and categorical variables plz?
This is a great video, thank you so much! I was wondering about the y axis in the calculation of a Shannon Diversity. If n represents the total abundance of all the sites, wouldn't it keep increasing for all metrics?
Hi Pat, thanks so much for your videos, they are pure gold! I was wondering how can I apply this to data in another format. I have a dataframe (df) with samples as rows and taxa as columns. I tried this code, but it doesn't work. df%>% summarize(richness=richness(x), shannon=shannon(x), simpson=simpson(x), invsimpson=1/simpson(x), n=sum(x)) I guess, I am not sure what to put instead of (value) as in your code. Or would I need to transform the data?
Thanks for watching! You’d still need to pivot longer to get columns of samples, taxa, and counts. Then group by samples and then the summarize function you have
Hi, thank you very much for the videos !! Im still new in R, and happy to learn Do you have any lecture video for functional diversity, traitspace, CWM using the FD packages?
Hi, this is great. I'm struggling with creating the function for Pielou’s Evenness Index and including that one along with richness, Shannon, Simpson. Please help.
Thanks for watching - i don't know that vegan does hill numbers (i've never used them in my work). You could certainly write your own function to do it in R
So basically, the alpha diversity is in our study plot, but in beta diversity, it must be compared to alpha diversity in other region/continent/island/country, mustn't it?
beta takes into account who is there and in what abundance. alpha doesn't care. two communities could have the same number of taxa (alpha), but completely different taxa (beta)
Hi there. How can I import the dataset from github into R? I select "Download" in the github file and it brings up the data in a table (the .shared file) in a new webpage, but I cannot figure out where to go from there. Thank you!
i have a table of tha that contains a information of each individual in one row , and i only want to select group, name and value when the result of value is the count of name times apear in one group.
@@jotaro.10 x is a "dummy" variable that is used to calculate the alpha diversity metric. If you look at around 4:00 you'll see the richness function is called with the values from the "value" column in the dataframe
Literally just started working with some invertebrate community data today and saw this. It's helpful! Thanks!
Wonderful!
Theis video series is so helpful! I am following along with my own data, highly recommended!
Stunning. Learnt alot from this vid. Thanks man, super clear!!!
My pleasure - thanks for watching!
I am so glad I found your channel 🙏Thank you for these videos!
You are so welcome! Thank you for watching 🤓
@@Riffomonas I have code question: my csv (Species.csv) is set up with the first column is Sample 1-520, and my columns after this are 125 plant codes with percent cover (ADBI .5, 1, 0, ....; ANDE 1, 0, .5,....). When I ran the vegan code for richness with specnumber(Species), I noticed I had one value of richness extra than when I calculated it with excel. I tried selecting only the species columns, specnumber(Species[2:126]) , and this worked but when I follow this same logic with my other indices of shannon diversity and evenness it changes things pretty drastically. So I'm wondering-- is it necessary to omit a label column such as Sample # so it's not used in the calculations, or does it not work this way? Any advice would be helpful-- I'm spending too much time on this quandary 😅
Thanks!
Molly
@@mollycribari7750 Thanks for the question. specnumber expects a matrix with rownames rather than having the rownames in a column like we do with tibbles. It basically does rowSum(Species > 0)
Thanks you Patch!
the best video ever
Beautiful !!!
Thank you! Glad you found the channel 🤓
Great content!
Could you show a video on how to incorporate the rarefied data from your previous videos into plotting alpha diversity to compare it to non-rarefied data?
Thanks Michael - I do this a few times over the series on rarefaction. Non rarefied data are more variable, larger and produce spurious significant differences more often when effects are confounded with sampling effort
Thank you, It would be helpful to add statistics on top of the alpha diversity metrics calculated. Thanks
I’m not 100% what you mean but you can add any text to a plot by adding a geom_text to the existing plot.
@@Riffomonas I meant calculate the significance of comparing between Alpha diversity of healthy and sick (or other conditions)
@@efratsharon1294 I second this, specifically how to run an ANOVA that shows whether the groups you were analyzing for the first 10 minutes of this video have a statistically significant difference in their alpha diversity values
Thank you so much Sir for your awesome video! Could you show us Generalized additive model using mgcv package with interpretation using a data contain both continues and categorical variables plz?
Thanks for watching! Unfortunately that’s not a tool I use so it’ll probably be awhile before I make a video with that
This is a great video, thank you so much! I was wondering about the y axis in the calculation of a Shannon Diversity. If n represents the total abundance of all the sites, wouldn't it keep increasing for all metrics?
Hi Pat, thanks so much for your videos, they are pure gold!
I was wondering how can I apply this to data in another format.
I have a dataframe (df) with samples as rows and taxa as columns. I tried this code, but it doesn't work.
df%>%
summarize(richness=richness(x),
shannon=shannon(x),
simpson=simpson(x),
invsimpson=1/simpson(x),
n=sum(x))
I guess, I am not sure what to put instead of (value) as in your code. Or would I need to transform the data?
Thanks for watching! You’d still need to pivot longer to get columns of samples, taxa, and counts. Then group by samples and then the summarize function you have
@@Riffomonas Thank you!
Hi, thank you very much for the videos !!
Im still new in R, and happy to learn
Do you have any lecture video for functional diversity, traitspace, CWM using the FD packages?
sorry but i don't
@@Riffomonas Thanks
Hi, this is great. I'm struggling with creating the function for Pielou’s Evenness Index and including that one along with richness, Shannon, Simpson. Please help.
remarkable lecture
Q: how can i calculate the hill number diversity index in r (q=0, q=1, and q=2)
Thanks for watching - i don't know that vegan does hill numbers (i've never used them in my work). You could certainly write your own function to do it in R
Does the Vegan function calculate Observed ASVs and Faith's Phylogenetic Diversity (PD) index?
Not that I know of. I calculated PD using mothur.
So basically, the alpha diversity is in our study plot, but in beta diversity, it must be compared to alpha diversity in other region/continent/island/country, mustn't it?
beta takes into account who is there and in what abundance. alpha doesn't care. two communities could have the same number of taxa (alpha), but completely different taxa (beta)
Can yo help me, in Anosim test how I can have the pairwase R and p values? I have the general result in Rstudio but not the pairwase result
You might need to assign the output to a variable and then run str on that variable
I am working on human GI nematodes which has one species, that has multiple ASvs are diversity measure important??
Thank you for the amazing tuto, but the "%>%" doesnt really work in my case, it always shows "could not find function "%>%", any solutions?
Thanks
you need to install the dplyr package
install.packages("dplyr")
library(dplyr)
be sure that you've run library(tidyverse) or library(magrittr) to get the %>% to work. Alternatively, you could use the base R pipe - |>
@@Riffomonas thank you
Hi there. How can I import the dataset from github into R? I select "Download" in the github file and it brings up the data in a table (the .shared file) in a new webpage, but I cannot figure out where to go from there. Thank you!
Thanks for watching Spencer. If you follow the video at riffomonas.org/code_club/2022-01-24-catching-up you'll see how to get the data you need.
@@Riffomonas Thank you!
what is the structure and format of the data and tables that you use to perform this analysis ?
i have a table of tha that contains a information of each individual in one row , and i only want to select group, name and value when the result of value is the count of name times apear in one group.
The rows are samples and the columns are taxa. You can see the file if you go to the link in the description and then to the GitHub link
i am a beginner, how to get that "x" in our data?
Sorry, I'm not sure where you are referring to - can you point me to where in the video you are asking about?
Like the one in richness
@@jotaro.10 x is a "dummy" variable that is used to calculate the alpha diversity metric. If you look at around 4:00 you'll see the richness function is called with the values from the "value" column in the dataframe