wefnexus

R-CMD-check CRAN status DOI License: GPL-3 Downloads Monthly Downloads Lifecycle: stable CodeFactor pkgdown

One package. Five dimensions. Ten interlinkages. A comprehensive R package for Water-Energy-Food-Nutrient-Carbon (WEFNC) nexus analysis in agricultural production systems.


Why wefnexus?

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.

Installation

Install the stable version from CRAN:

install.packages("wefnexus")

Or install the development version from GitHub:

# install.packages("devtools")
devtools::install_github("lalitrolaniya/wefnexus")

What’s new in 1.1.0

Modules

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()

Quick start

Replicated field trial in one call

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)

Figures

plot(res$anova, response = c("grain_yield", "WUE", "EUE", "CI"), ncol = 2)

Treatment means with standard error bars and LSD letter groups for grain yield, WUE, energy use efficiency and carbon intensity

plot(res)   # one radar per treatment, dashed line = mean of all treatments

Radar small multiples of the five WEFNC dimension scores for six 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?

Rank chart of six treatments across eight ranking methods with Kendall's W

Energy budget from field records

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)

Individual indicators

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)

Key features

Documentation

# 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/

Data format

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.

Citation

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

Authors

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

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Found a bug? Have a feature request? Open an issue

Support

If you find this package useful, please ⭐ star this repository — it helps others discover it!

License

GPL (>= 3)

mirror server hosted at Truenetwork, Russian Federation.