--- title: "Quantitative ethnoecology analysis with ethnoecologyR" author: "Marwan Setiawan, BRIN" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Quantitative ethnoecology analysis with ethnoecologyR} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.align = "center", message = FALSE, warning = FALSE ) library(ethnoecologyR) library(dplyr) library(ggplot2) data(ethnoecology_data) # Helper: plot any index data frame as a horizontal bar chart. # `value_col` = name of the column to plot on the x-axis (the index value). plot_index <- function(df, value_col, title, fill = "#2d6a4f") { df <- as.data.frame(df) grp_col <- grep("landscape|informant|species|group", names(df), value = TRUE, ignore.case = TRUE)[1] ggplot(df, aes(x = reorder(.data[[grp_col]], .data[[value_col]]), y = .data[[value_col]])) + geom_col(fill = fill) + coord_flip() + labs(title = title, x = NULL, y = value_col) + theme_minimal(base_size = 12) } ``` # Quantitative ethnoecology analysis with `ethnoecologyR` #### Marwan Setiawan, BRIN Please remember to cite the `ethnoecologyR` package if you use it in your publications. Use `citation("ethnoecologyR")` to get a citation for the latest version. > To cite package 'ethnoecologyR' in publications use: > > Marwan Setiawan (2026). _ethnoecologyR: Quantitative Ethnoecology Analysis and Landscape Knowledge Modeling_. R package version 0.1.5. ## A Critical Perspective on Ethnoecology Indices Quantitative ethnoecology is the study of the use and importance of landscape units and ecosystems in human cultures, using statistical and analytical methods to quantify and interpret data. This approach has emerged as a key tool for understanding the cultural and ecological significance of landscape units, and for evaluating the impact of human activities on ecosystems. While widely used in the literature, traditional ethnoecology indices have significant limitations that researchers should consider: - **Oversimplification**: Complex cultural-ecological relationships reduced to single numbers - **Context stripping**: Remove cultural, ecological, and historical context - **Methodological issues**: Sensitive to sampling design and interview methods - **Theoretical concerns**: Often lack strong theoretical foundations **When to use these indices:** - Preliminary exploratory analysis - Comparison with existing literature that uses similar methods - As input variables for more sophisticated models (not as final results) **When to avoid these indices:** - As primary evidence for policy decisions - For cross-cultural comparisons without careful validation - As standalone measures of "importance" ## Using the `ethnoecologyR` package The `ethnoecologyR` package offers quantitative tools to assess the cultural significance of landscape units based on informant consensus. The package closely follows several key papers on ethnoecology indices (Tardío and Pardo-de-Santayana 2008; Friedman et al. 1986; Reyes-García et al. 2006; Toledo 2002). The goal is to provide an easy-to-use platform for ethnoecologists to perform quantitative ethnoecology assessments. Users are highly encouraged to familiarize themselves with ethnoecology theory (Berkes 2012; Toledo 2002) and social-ecological systems theory (Ostrom 2009). An overview of this theoretical background will be helpful in understanding approaches in ethnoecology and formulating useful research questions. An example data set called `ethnoecology_data` is provided to show how standard quantitative ethnoecology data should be formatted to interface with the `ethnoecologyR` package. This is an ethnoecology data set including one column of knowledge-holder identifiers `informant`, one column of landscape unit names `landscape_unit`, and several binary columns for ethnoecology use categories. The data in the use-category columns are counts of uses per person (0 or 1). ```{r data-table, echo = FALSE} knitr::kable( head(ethnoecology_data, 6), digits = 0, caption = "First six rows of the example ethnoecology data included with ethnoecologyR" ) ``` Many of the functions in `ethnoecologyR` make use of `select()` and `filter()` functions of the `dplyr` package (Wickham et al. 2026) and pipe functions `%>%` from the `magrittr` package (Bache and Wickham 2025). The intention is that these should be easy to understand and use, and that they should allow users the chance to pull the code for these functions and change anything they see fit. ### Data preparation with `ethno_data_prep()` Before running any analyses, data can be reshaped with `ethno_data_prep()`. This helper returns a cleaned data frame in either wide (`pivot_long = FALSE`) or long (`pivot_long = TRUE`, default) format, which is convenient for downstream functions that expect `use_category` columns. ```{r data-prep} long_data <- ethno_data_prep(ethnoecology_data, pivot_long = TRUE) knitr::kable(head(long_data, 8), caption = "Long-format data returned by ethno_data_prep()") ``` ## Ethnoecology indices functions Ethnoecology indices are numerical measures used to quantify the importance of landscape units in different cultural or ecological contexts. Several common ethnoecology indices are implemented in `ethnoecologyR`. These indices allow researchers to compare the relative importance of different landscape units within a particular culture or ecosystem. The standard quantitative ethnoecology indices are probably too narrow a tool for a proper assessment of human-ecological interactions. Still, they offer a useful entry into understanding some aspects of how human communities interact with nature. The steps required to calculate these indices offer a way to quantify intangible factors of how human communities interact with the world. They can come in handy as additive pieces for more holistic assessments and analyses. ### Landscape Use (LU) The Landscape Use (LU) index is a measure of the overall importance of a landscape unit based on the total number of use reports. It is calculated as: `LU = sum of use reports for a landscape unit` ```{r LUs, fig.width=8, fig.height=4.5, fig.cap="Landscape Use (LU) per landscape unit"} lu_result <- LUs(ethnoecology_data) knitr::kable(lu_result, caption = "Landscape Use index (LU)") plot_index(lu_result, "LU", "Landscape Use (LU)") ``` ### Cultural Importance in Ecology (CIE) The Cultural Importance in Ecology (CIE) index is a normalized measure of use intensity. It is calculated as: `CIE = LU / N`, where N is the number of informants. ```{r CIEs, fig.width=8, fig.height=4.5, fig.cap="Cultural Importance in Ecology (CIE) per landscape unit"} cie_result <- CIEs(ethnoecology_data) knitr::kable(cie_result, digits = 3, caption = "Cultural Importance in Ecology (CIE)") plot_index(cie_result, "CIE", "Cultural Importance in Ecology (CIE)") ``` ### Frequency of Citation (FC) The Frequency of Citation (FC) is the number of informants who mention a landscape unit for any use. ```{r FCs, fig.width=8, fig.height=4.5, fig.cap="Frequency of Citation (FC) per landscape unit"} fc_result <- FCs_eco(ethnoecology_data) knitr::kable(fc_result, caption = "Frequency of Citation (FC)") plot_index(fc_result, "FC", "Frequency of Citation (FC)") ``` ### Fidelity Level (FL) The Fidelity Level (FL) is the percentage of informants who mention a landscape unit for a specific use category. It is calculated as: `FL = (number of informants mentioning the unit for a specific use / total number of informants mentioning the unit for any use) × 100` ```{r FLs, fig.width=8, fig.height=4.5, fig.cap="Fidelity Level (FL) for the use_forest category"} fl_result <- FLs_eco(ethnoecology_data, "use_forest") knitr::kable(fl_result, digits = 1, caption = "Fidelity Level (FL) for use_forest") plot_index(fl_result, "FL", "Fidelity Level (FL) — use_forest") ``` ### Number of Uses (NU) The Number of Uses (NU) is the total number of distinct use categories reported for each landscape unit. ```{r NUs, fig.width=8, fig.height=4.5, fig.cap="Number of Uses (NU) per landscape unit"} nu_result <- NUs_eco(ethnoecology_data) knitr::kable(nu_result, caption = "Number of Uses (NU)") plot_index(nu_result, "NU", "Number of Uses (NU)") ``` ### Cultural Value of Ecolandscape (CVe) The Cultural Value of Ecolandscape (CVe) is a composite index combining LU and FC. It is calculated as: `CVe = (LU / N) × (FC / N)` ```{r CVes, fig.width=8, fig.height=4.5, fig.cap="Cultural Value (CVe) per landscape unit"} cv_result <- CVe_eco(ethnoecology_data) knitr::kable(cv_result, digits = 3, caption = "Cultural Value (CVe)") plot_index(cv_result, "CVe", "Cultural Value (CVe)") ``` ### Ranking with `ethno_ranking()` `ethno_ranking()` takes any index function (e.g., `CIEs`, `NUs_eco`) and returns the top *n* landscape units ranked by that index. This is useful for rapid identification of priority units. ```{r ranking, fig.width=8, fig.height=4, fig.cap="Top 5 landscape units by Cultural Importance (CIE)"} top_cie <- ethno_ranking(ethnoecology_data, index_function = CIEs, top_n = 5) knitr::kable(top_cie, digits = 3, caption = "Top 5 landscape units by CIE") plot_index(top_cie, "CIE", "Top 5 landscape units by CIE") ``` ### Richness with `ethno_richness()` `ethno_richness()` computes richness (the number of distinct items) per group. When the default `count_col = "species"` is not present, the function automatically falls back to an available identifier and emits an informational message. ```{r richness, fig.width=8, fig.height=4.5, fig.cap="Richness per landscape unit"} rich_result <- ethno_richness(ethnoecology_data, group_by = "landscape_unit") knitr::kable(rich_result, caption = "Richness per landscape unit") plot_index(rich_result, "Richness", "Richness per landscape unit") ``` ### Habitat × Use analysis with `ethno_habitat_analysis()` `ethno_habitat_analysis()` cross-tabulates the number of use reports per habitat and use category. It automatically detects `use_*` columns in wide-format data, and also accepts long-format input through the `use_col` argument. ```{r habitat, fig.width=9, fig.height=4.5, fig.cap="Habitat × use-category cross-table"} hab_result <- ethno_habitat_analysis(ethnoecology_data) knitr::kable(hab_result, caption = "Habitat × use-category cross-table") ``` ## Working with figures Figures help to visually represent the main ideas or key results of ethnoecology work. The following sections walk through the visualization functions provided by `ethnoecologyR`. ### Chord diagrams with circlize The chord plots are built with the `circlize` package (Gu 2022). An example of chord plots in ethnoecology is described by Whitney, Bahati, and Gebauer (2018). The `ethno_landscape_chord()` function creates a chord diagram of ethnoecology uses and landscape units. ```{r chord-landscape, fig.width=8, fig.height=8, fig.cap="Chord diagram of landscape units and uses"} ethno_landscape_chord(ethnoecology_data, by = "landscape_unit") ``` The function can also produce a chord diagram of informants and uses. ```{r chord-informant, fig.width=8, fig.height=8, fig.cap="Chord diagram of informants and uses"} ethno_landscape_chord(ethnoecology_data, by = "informant") ``` ### Alluvial plots with ggalluvial The `ethno_landscape_alluvial()` function creates an alluvial diagram showing flows between informants, landscape units, and ecological uses. ```{r alluvial, fig.width=10, fig.height=7, fig.cap="Alluvial plot of landscape uses"} ethno_landscape_alluvial(ethnoecology_data) ``` ### Bipartite network with `ethno_landscape_network()` `ethno_landscape_network()` produces a bipartite network between landscape units (or informants, when `by = "informant"`) and use categories. Nodes represent landscape units and use categories; edges connect a unit to the categories it provides. The function uses a Fruchterman–Reingold force-directed layout. Because the function accepts both wide and long formats, users can pass data straight from a field spreadsheet without reshaping. ```{r network, fig.width=9, fig.height=7, fig.cap="Bipartite network of landscape units and use categories"} ethno_landscape_network(ethnoecology_data, by = "landscape_unit") ``` ### Radial plot with `landscape_radial_plot()` The `landscape_radial_plot()` function creates a radial bar plot for one or more ethnoecology indices per landscape unit. The `indices_list` argument must be a **list of functions** (not a list of results), so the function can compute each index internally. ```{r radial, fig.width=8, fig.height=8, fig.cap="Radial plot of three ethnoecology indices"} landscape_radial_plot(ethnoecology_data, list(LUs, CIEs, FCs_eco)) ``` ### Combine several indices in a single grid For side-by-side comparison, multiple radial plots can be combined into a single publication-ready figure with `cowplot::plot_grid()`. ```{r radial-grid, fig.width=10, fig.height=9, fig.cap="Comparison of four ethnoecology indices in a 2×2 grid"} library(cowplot) plots <- list( LU = landscape_radial_plot(ethnoecology_data, list(LUs)), CIE = landscape_radial_plot(ethnoecology_data, list(CIEs)), FC = landscape_radial_plot(ethnoecology_data, list(FCs_eco)), NU = landscape_radial_plot(ethnoecology_data, list(NUs_eco)) ) cowplot::plot_grid( plotlist = plots, labels = names(plots), nrow = 2, align = "hv", label_size = 14 ) ``` > **Note:** Warnings about *"Removed N rows containing missing values"* may appear when the supplied indices do not cover identical sets of landscape units. This is expected behaviour: rows with missing values are dropped by `ggplot2`. ## Landscape Resilience Index (LRI) The `ethno_resilience()` function computes a composite **Landscape Resilience Index (LRI)** per landscape unit. The LRI is defined as the sum of three normalised components: - **Use Value (UV)**: total number of use reports for the landscape unit - **Functional Level (FL)**: number of distinct use categories associated with the unit - **Shannon diversity (H)**: entropy of the use-category distribution within the unit `LRI = (UV / max(UV)) + (FL / max(FL)) + (H / max(H))` This index provides a single score that captures both the intensity and the diversity of landscape use. It is intended as a starting point for identifying landscape units that combine high use pressure with high functional redundancy. ```{r resilience, fig.width=8, fig.height=5, fig.cap="Landscape Resilience Index (LRI) per landscape unit"} lri_result <- ethno_resilience(ethnoecology_data) knitr::kable(lri_result, digits = 3, caption = "Landscape Resilience Index (LRI)") plot_index(lri_result, "LRI", "Landscape Resilience Index (LRI)") ``` ## Bayesian Consensus Modeling `ethno_bayes_land()` fits a Bayesian model that estimates consensus among informants regarding landscape use. The model is fitted using Hamiltonian Monte Carlo via `rstan` (Stan Development Team 2024). Because compilation and sampling are time-intensive, the example is shown but not executed here. ```{r bayes, eval = FALSE} fit <- ethno_bayes_land(ethnoecology_data, iter = 500, chains = 2) print(fit, pars = c("theta[1]", "theta[2]", "theta[3]")) ``` ## Bootstrap Confidence Intervals `ethno_boot_land()` computes bootstrap confidence intervals for any index function, providing a non-parametric estimate of uncertainty. The `R` argument controls the number of resamples. ```{r bootstrap} set.seed(42) boot_ci <- ethno_boot_land(ethnoecology_data, index_function = CIEs, R = 100) print(boot_ci) ``` ## Full workflow example The following minimal example strings together the main steps of a quantitative ethnoecology analysis. Users can copy and adapt this code as a starting template for their own data. ```{r workflow, eval = FALSE} library(ethnoecologyR) library(dplyr) library(ggplot2) # 1. Load data data(ethnoecology_data) # 2. Prepare long <- ethno_data_prep(ethnoecology_data, pivot_long = TRUE) # 3. Core indices lu <- LUs(ethnoecology_data) cie <- CIEs(ethnoecology_data) nu <- NUs_eco(ethnoecology_data) # 4. Rank landscape units by cultural importance top <- ethno_ranking(ethnoecology_data, index_function = CIEs, top_n = 5) print(top) # 5. Habitat × use cross-table habitat <- ethno_habitat_analysis(ethnoecology_data) print(habitat) # 6. Resilience index lri <- ethno_resilience(ethnoecology_data) print(lri) # 7. Visualizations ethno_landscape_network(ethnoecology_data) ethno_landscape_alluvial(ethnoecology_data) landscape_radial_plot(ethnoecology_data, list(LUs, CIEs, FCs_eco)) ``` ## Troubleshooting | Error message | Likely cause | Solution | |---------------|--------------|----------| | `Column 'use_category' not found` | Data passed in wide format but function requires long | Use `ethno_data_prep(data, pivot_long = TRUE)` first, or rely on auto-detection where supported | | `Column 'species' not found` | `ethno_richness()` cannot find the default count column | Pass `count_col = "your_column"`, or accept the automatic fallback | | `argument "index_function" is missing` | Function requires an index function | e.g., `ethno_ranking(data, index_function = CIEs, top_n = 5)` | | `argument "use_category" is missing` | `FLs_eco()` needs a specific use category | e.g., `FLs_eco(data, use_category = "use_forest")` | | `Removed N rows containing missing values` | Two indices cover different landscape units | Expected behaviour; ensure all indices are computed on the same set of units | | Stan compilation warnings | `rstan` / Rtools not installed | Install `rstan` and Rtools4.x, then restart R | | `object 'data_super' not found` | R session restarted without re-reading the source spreadsheet | Re-run the `readxl::read_excel()` call that created the data | ## Conclusions Quantitative ethnoecology offers a way to study the use and importance of landscape units in human cultures, using statistical and analytical methods to quantify and interpret data. This approach is useful in a variety of contexts, including: - Understanding the cultural and ecological significance of landscape units - Evaluating the impact of human activities on ecosystems - Informing conservation and management strategies - Documenting local ecological knowledge (LEK) One of the main benefits of quantitative ethnoecology is that it allows researchers to rigorously and systematically analyse and interpret data, providing more reliable and objective insights into the role of landscape units in different cultural and ecological settings. Overall, the `ethnoecologyR` package provides a comprehensive set of tools for researchers and practitioners working in ethnoecology and related fields. By using these standardized methods and statistical analyses, researchers can more accurately compare and contrast the importance of different landscape units and evaluate the significance of their findings. ## Acknowledgements This work was inspired by the pioneering contributions of: - Cory Whitney and the `ethnobotanyR` package - Tardío and Pardo-de-Santayana (2008) on cultural importance indices - Friedman et al. (1986) on fidelity level - Reyes-García et al. (2006) on cultural value - Berkes (2012) on sacred ecology The vignette was written and formatted using the tools provided by the `knitr` package (Xie 2025). ## References Bache, Stefan Milton, and Hadley Wickham. 2025. Magrittr: A Forward-Pipe Operator for R. https://magrittr.tidyverse.org. Berkes, F. 2012. *Sacred Ecology*. 3rd ed. Routledge. Canty, A., and B. Ripley. 2024. boot: Bootstrap R (S-Plus) Functions. R package version 1.3-30. Friedman, J., Z. Yaniv, A. Dafni, and D. Palewitch. 1986. "A Preliminary Classification of the Healing Potential of Medicinal Plants, Based on a Rational Analysis of an Ethnopharmacological Field Survey Among Bedouins in the Negev Desert, Israel." *Journal of Ethnopharmacology* 16(2-3): 275-287. Gu, Z. 2022. circlize: Circular Visualization. R package version 0.4.15. Ostrom, E. 2009. "A General Framework for Analyzing Sustainability of Social-Ecological Systems." *Science* 325(5939): 419-422. R Core Team. 2025. R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. Reyes-García, V., T. Huanca, V. Vadez, W. Leonard, and D. Wilkie. 2006. "Cultural, Practical, and Economic Value of Wild Plants: A Quantitative Study in the Bolivian Amazon." *Economic Botany* 60(1): 62-74. Stan Development Team. 2024. RStan: The R Interface to Stan. R package version 2.32.6. Tardío, J., and M. Pardo-de-Santayana. 2008. "Cultural Importance Indices: A Comparative Analysis Based on the Useful Wild Plants of Southern Cantabria (Northern Spain)." *Economic Botany* 62(1): 24-39. Toledo, V. M. 2002. "Ethnoecology: A Conceptual Framework for the Study of Indigenous Knowledge of Nature." In *Ethnobiology and Biocultural Diversity*, edited by J. R. Stepp, F. S. Wyndham, and R. K. Zarger, 511-522. University of Georgia Press. Whitney, C. W., J. Bahati, and J. Gebauer. 2018. "Ethnobotany and Agrobiodiversity: Valuation of Plants in the Homegardens of Southwestern Uganda." *Ethnobiology Letters* 9(2): 1-12. Wickham, H., et al. 2026. dplyr: A Grammar of Data Manipulation. R package version 1.1.0. Wickham, H., and L. Henry. 2026. purrr: Functional Programming Tools. R package version 1.0.0. Wickham, H., D. Vaughan, and M. Girlich. 2025. tidyr: Tidy Messy Data. R package version 1.3.0. Xie, Y. 2025. knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.45.