Provides functions for analysing
Water-Energy-Food-Nutrient-Carbon (WEFNC) nexus interactions in
agricultural production systems. Includes functions for
computing water use efficiency (WUE), water productivity (WP),
and water footprint (WF) including green, blue, and grey
components following the methodology of Hoekstra et al. (2011,
ISBN:9781849712798). Includes energy budgeting tools for energy
use efficiency (EUE), energy return on investment (EROI), net
energy (NE), and energy productivity (EP). Computes nutrient
use efficiency (NUE) metrics including agronomic efficiency
(AE), physiological efficiency (PE), recovery efficiency (RE),
and partial factor productivity (PFP) as defined by Dobermann
(2007) < https://digitalcommons.unl.edu/agronomyfacpub/316/> and
Congreves et al. (2021)

One package. Five dimensions. Ten interlinkages. A comprehensive R package for Water-Energy-Food-Nutrient-Carbon (WEFNC) nexus analysis in agricultural production systems.
Modern agriculture doesn't work in silos. When we save water, it affects energy use. When we add fertilizers, it impacts carbon emissions. When we change tillage, it affects food production, soil health, and everything in between.
wefnexus connects all 5 dimensions in one package โ giving researchers, policymakers, and agronomists the tools to see the full picture and make decisions that are truly sustainable.
Install the stable version from CRAN:
install.packages("wefnexus")
Or install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("lalitrolaniya/wefnexus")
nexus_analysis() takes plot-level data
(treatment x replication) and returns indicators, an ANOVA table, the
composite nexus index and a TOPSIS ranking.nexus_anova() gives means with letter groups,
SEm, CD (5%) and CV for CRD and RCBD trials.nexus_weights() derives weights by entropy,
CRITIC or PCA instead of assuming equal weights.nexus_topsis() ranks treatments on raw indicators.energy_budget() turns litres,
kilograms and labour hours into MJ/ha, with direct/indirect and
renewable/non-renewable shares, using an editable energy_coefficients
table.nexus_rank_compare() ranks treatments eight ways
and reports Kendall's W, so you can show a recommendation does not
hinge on one choice of weights.plot() works on every result: means
with error bars and letters, radar small multiples, TOPSIS rankings,
energy budgets, and a trade-off heatmap with significance stars, all in
a colour-blind-checked palette.nexus_summary(nutrient_metric = "iue") works when
no fertilizer N is applied; ef_n2o = 0.005 applies the IPCC dry-climate
N2O factor.soil_carbon_stock() was 10 times too low, and
nexus_heatmap_gg() swapped row labels; also fixed NHI in
nutrient_use_efficiency(), water_footprint(area) and
nexus_summary(). See NEWS.| Module | Functions | Key metrics |
|---|---|---|
| ๐ง Water | 7 | WUE, WP (physical/economic), WF (green/blue/grey), irrigation efficiency, CWSI, CWP, depleted fraction |
| โก Energy | 11 | Energy budget from quantities, EUE, EROI, EP, energy intensity, specific energy, net energy, energy profitability |
| ๐พ Food | 8 | FPI, crop yield index, HI, LER, SPI, caloric and protein yield, PEI |
| ๐งช Nutrient | 8 | AE, PE, RE, PFP, IUE, NHI, NPK balance, one-call NUE report |
| ๐ฟ Carbon | 7 | CF (source-wise), GHG (IPCC Tier 1), SOC stock, sequestration rate, GWP (AR6), CSI |
| ๐ Nexus | 16 | Normalization, composite index, entropy/CRITIC/PCA weights, TOPSIS, ranking robustness (Kendall's W), trade-off matrix and heatmap, sensitivity, radar, heatmap |
| ๐งญ Workflow | 2 | nexus_analysis(), nexus_anova() |
library(wefnexus)
options(wefnexus.verbose = FALSE) # silence messages
data(arid_pulse_trial) # 6 treatments x 3 replications (RCBD)
res <- nexus_analysis(
arid_pulse_trial,
treatment = "treatment", block = "replication",
yield = "grain_yield", water = "total_water",
energy_in = "energy_input", energy_out = "energy_output",
emission = "ghg_emission", n_uptake = "n_uptake",
weights = "entropy"
)
res # nexus index and TOPSIS ranks
res$anova # means + letters, SEm, CD (5%), CV
plot(res$nexus)
plot(res$anova, response = c("grain_yield", "WUE", "EUE", "CI"), ncol = 2)
plot(res) # one radar per treatment, dashed line = mean of all treatments
nx <- res$nexus
indicators <- data.frame(WUE = nx$WUE_kg_mm, EUE = nx$EUE_ratio,
Yield = nx$yield_kg_ha, IUE = nx$IUE_kg_kgN,
CI = nx$carbon_intensity)
rc <- nexus_rank_compare(indicators, benefit = c(TRUE, TRUE, TRUE, TRUE, FALSE),
treatment_names = nx$treatment)
plot(rc) # do rankings hold across eight weighting/aggregation methods?
inputs <- data.frame(
treatment = c("CT", "ZT"),
human_labour_man = c(320, 240), diesel = c(65, 38),
electricity = c(180, 75), nitrogen = c(20, 20), phosphorus = c(40, 40),
seed = c(20, 20), herbicide = c(0, 0.75),
grain = c(980, 1280), straw = c(1450, 1850)
)
energy_budget(inputs)
data(arid_pulse_nexus)
d <- arid_pulse_nexus
water_use_efficiency(d$grain_yield, d$total_water)
eroi(d$energy_output_grain + d$energy_output_straw, d$energy_input)
carbon_footprint(diesel_use = 65, electricity_use = 180,
n_fertilizer = 20, yield = 980, ef_n2o = 0.005)
print(), summary() and plot() methods# Complete vignette with all 6 modules
browseVignettes("wefnexus")
# View the built-in sample dataset
?arid_pulse_nexus
# Help for any function
?carbon_footprint
?nexus_summary
?water_use_efficiency
๐ Full documentation website: https://lalitrolaniya.github.io/wefnexus/
Use replication-level data (one row per plot) where you can. It keeps
the variability needed for ANOVA, SEm and CD, and nexus_analysis()
handles the aggregation to treatment means. Treatment means also work;
ANOVA is then skipped.
If you use wefnexus in your research, please cite:
citation("wefnexus")
Rolaniya, L.K., Poonia, H., Jat, R.L., Punia, M. & Choudhary, R.R. (2026).
wefnexus: Water-Energy-Food-Nutrient-Carbon Nexus Analysis for Agronomic
Systems. R package version 1.1.0. https://CRAN.R-project.org/package=wefnexus
DOI: 10.32614/CRAN.package.wefnexus
| Author | Affiliation |
|---|---|
| Lalit Kumar Rolaniya (maintainer) | Scientist (Agronomy), ICAR-IIPR RC Bikaner |
| Hemant Poonia (deceased) | Assistant Professor, Dept of Mathematics & Statistics, CCS HAU Hisar |
| Ram Lal Jat | Scientist, ICAR-IIPR RC Bikaner |
| Monika Punia (deceased) | Scientist, ICAR-IIPR RC Bikaner |
| Raja Ram Choudhary | Scientist, ICAR-IIGR RRS Bikaner |
Version 1.1.0 is dedicated to the memory of our co-authors Dr. Monika Punia and Dr. Hemant Poonia.
| Resource | URL |
|---|---|
| ๐ฆ CRAN | https://CRAN.R-project.org/package=wefnexus |
| ๐ Documentation | https://lalitrolaniya.github.io/wefnexus/ |
| ๐ป Source Code | https://github.com/lalitrolaniya/wefnexus |
| ๐ DOI | 10.32614/CRAN.package.wefnexus |
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Found a bug? Have a feature request? Open an issue
If you find this package useful, please โญ star this repository โ it helps others discover it!
GPL (>= 3)