cwwhitney / ethnobotanyr Goto Github PK
View Code? Open in Web Editor NEWR package for quantitative ethnobotany
R package for quantitative ethnobotany
Idea from @VincentPorcher
Add latent block model approach
obs of people with animal and plants
stochastic approach
The calculation of both CIs UVs and simple UVs seems over excessive.
They all calculate the exact same thing correctly - but it seems error prone to do it in three different ways.
All three implementations calculate the exact same thing, and I would suggest using only one function and letting the other functions just refer to that one function.
The implementation of CIs looks cleanest and I would suggest the others just pointed to that.
Quantitative methods in ethnobotany and ethnopharmacology: considering the overall flora--hypothesis testing for over- and underused plant families with the Bayesian approach.
https://www.ncbi.nlm.nih.gov/pubmed/21767623
Spiritual and ceremonial plants in North America: an assessment of Moerman's ethnobotanical database comparing Residual, Binomial, Bayesian and Imprecise Dirichlet Model (IDM) analysis.
@CWWhitney, Thank you for the development of the package! Is it possible to change the colors? which function do you use to change the colors of the CIs-plot?
Originally posted by @KamilaBio in #21 (comment)
All functions seem to return a result using as.data.frame(...)
.
The built in example dataset is also a data frame class.
Since the package is marketed as an intended expansion package working with tidyverse is should probably be updated to tibbles.
@VincentPorcher
Publicfreelisting and curves cf. https://link.springer.com/article/10.1007/s10745-023-00450-9
Idea from @VincentPorcher
Make more options for updating ggplot
Idea from @VincentPorcher
add consensus test / model to the package
FLs is calculated correctly, as in the cited paper. But it is stated wrongly in the vignette.
Where it states URs it should state FCs instead, as this is what you actually do.
It should also state that the values are multiplied by 100, both in the vignette and in the help file.
Read IPBES and make links (this as protocol)
https://pubmed.ncbi.nlm.nih.gov/35066067/
"These indices are claimed to serve as a proxy for efficacy or drug discovery (Fidelity Level 'FL') and to show the importance of botanical drugs and plants used as medicines (Relative Importance 'RI', Use Value 'UV' or Cultural Importance Index 'CI', Cultural Value Index 'CV', Relative Frequency of Citation 'RFC'). This is, however, doubtful, as these indices have not been developed by statisticians, nor by pharmacologists while a proof of concept is lacking. Moreover, the question whether a simple number can summarize the cultural value or importance of plants is not only mathematical but also epistemological."
A paper that
Map of countries and number of ethnobotany studies.
Would require a simple review that collects location of research for all papers.
Can we generate an algorithm that scans papers in a selection of journals or from a database?
The map can just be a global heat map:
cf. This map of how important religion is around the world.
Idea from @VincentPorcher
Make more notes
Clarify steps (especially for our non-natural-sciences anthropology colleagues).
CVe gives the wrong result + it gives a warning because of the bind_cols command.
I have highlighted the problematic sections below and my suggestions for fixing them.
CVe <- FCs <- UR_UN_FC <- CVe <- URdata <- data_Ci <- data_URs <- URps <- sp_name <- informant <- NULL
URdata <- ethnobotanydata
URS <- URs(URdata)
NUS <- NUs(URdata)
NUS$Uce <- NUS$NUs/ncol(dplyr::select(URdata, -informant, -sp_name))
FCS <- FCs(URdata)
FCS$Ice <- FCS$FCs/length(unique(URdata$informant))
# ERROR 1:
# REMOVE
# UR_UN_FC <- dplyr::bind_cols(NUS, URS, FCS)
# REPLACE WITH THIS:
UR_UN_FC <- dplyr::left_join(NUS, URS) %>% dplyr::left_join(FCS)
UR_UN_FC$IUce <- UR_UN_FC$URs/length(unique(URdata$informant))
# ERROR 2 (Maybe???)
# REMOVE
# UR_UN_FC$CVe <- UR_UN_FC$Uce * UR_UN_FC$Ice * sum(UR_UN_FC$IUce)
# REPLACE WITH THIS:
UR_UN_FC$CVe <- UR_UN_FC$Uce * UR_UN_FC$Ice * UR_UN_FC$IUce
CVe <- dplyr::select(UR_UN_FC, sp_name, CVe) %>% dplyr::arrange(-CVe) %>%
dplyr::mutate(CVe = round(CVe, 3))
as.data.frame(CVe)
With @Wycology and @VincentPorcher
Generate training materials as interactive Rmarkdown (user-friendly).
Focus on different hypotheses in ethnobotany (these papers a guide):
Hypothesis Testing in Ethnobotany: 30 years After Phillips & Gentry's Seminal Work
https://ethnobioconservation.com/index.php/ebc/article/view/761
Theories and Major Hypotheses in Ethnobotany
https://www.jstor.org/stable/45171690
Look at possible ways to use area curves and time curves for quantitative analysis.
Start with Eight to Late
https://eight2late.wordpress.com/2015/05/27/a-gentle-introduction-to-text-mining-using-r/
Since the package is marketed as an addition to tidyverse, I think it is important all functions work with tibbles.
The function FLs()
doesn't work with tibbles due to the functions use of reshape::melt(...)
.
The easiest fix (but not the best) is simply to replace reshape
with reshape2
.
The function could be rewritten to be based on tidyverse functions, to avoid problems like this.
We discussed the incorporation of spatial analysis. Maybe a tall order but we should at least think about it.
The papers:
Harou et al. - 2020 - Mapping Flood-Based Farming Systems with Bayesian .pdf
Liman Harou et al. - 2021 - Crop modelling in data-poor environments – A knowl.pdf
Due to the use of this function:
RFCdata <- RFCdata %>% dplyr::mutate_if(is.numeric, ~1 *
(. != 0))
The function doesn't work if the informant column is numeric. I am afraid that this error might occur elsewhere as well, but I have not come across it so far.
The line can simply be replaced with, which would work:
RFCdata$FCps <- (RFCdata$FCps > 0) * 1
Suggest a tutorial / training how to use the package related to ethnobotany cf. https://www.youtube.com/watch?v=QPdJNqXHxmI&lc=Ugw3YEztKdXhdtrv0mF4AaABAg
Suggestion to can give a example of tabulated data like in SR plot software. So that it will help new learners too. This from Ajendra Singh Bagri, co-author of 'Ethnomedicinal plants used in Khatling valley of Western Himalaya, India'. The paper used a number of ethnobotanyR functions.
Add more functions
A call for 'Regression and correlation and PCA among the ethnobotany dataset'. This today from Ankit Singh, co-author of 'Ethnomedicinal plants used in Khatling valley of Western Himalaya, India'. The paper used a number of ethnobotanyR functions.
This is feedback from many others too.
The code doesn't seem to calculate the Relative Importance Index as in the paper you cite.
I think the RFCs(max) part of the code is wrong.
Your code says:
RFCs <- RFCdata %>% dplyr::group_by(sp_name) %>% dplyr::summarize(RFCs = sum(FCps/(length(unique(informant))))) %>% dplyr::arrange(-RFCs)
Which gives FCs
over total number of informants not over the max(FCs)
. There are 20 unique
informants for all species in the test dataset, even though not all of them mention all species.
For the test dataset your code gives this:
> ethnobotanyR::RIs(ethnobotanydata)
sp_name RIs
1 sp_c 0.925
2 sp_a 0.812
3 sp_d 0.800
4 sp_b 0.738
while the RI should be:
> RFCsmax <- FCs(ethnobotanydata) %>% mutate(RFCsmax = FCs/max(FCs))
> RNUsmax <- NUs(ethnobotanydata) %>% mutate(RNUsmax = NUs/max(NUs))
>
> RI <- left_join(RFCsmax, RNUsmax, by = "sp_name")
> RI %>% mutate(RIs = (RFCsmax + RNUsmax) / 2) %>% arrange(desc(RIs))
sp_name FCs RFCsmax NUs RNUsmax RIs
1 sp_c 17 1.0000000 8 1.000 1.0000000
2 sp_a 15 0.8823529 7 0.875 0.8786765
3 sp_d 12 0.7058824 8 1.000 0.8529412
4 sp_b 12 0.7058824 7 0.875 0.7904412
I have spent some time trying to understand this discrepancy. If I have misunderstood the paper or your function please let me know. I am teaching a course next month using your package and before i confuse my students too much, I would like to know if I'm mistaken or the package has a bug.
If I am right your code could read:
RFCs <- RFCdata %>% dplyr::group_by(sp_name) %>% dplyr::summarize(FCs = sum(FCps)) %>%
mutate(RFCs = FCs/max(FCs), FCs = NULL) %>%
dplyr::arrange(-RFCs)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.