R/sNUE.R

Defines functions sNUE

Documented in sNUE

#' Calculate NUE of a System (sNUE)
#' @description
#' The fraction of system N outputs that are captured as N yield.
#' Formula: sNUE = YieldN / (YieldN + Nloss)
#' @param YieldN Observed crop yield N.
#' @param Nloss N lost from the system.
#' @return A numeric vector of sNUE values.
#' @examples
#' YieldN <- c(80, 90, 100)
#' Nloss <- c(20, 25, 20)
#' sNUE(YieldN, Nloss)
#' @export
sNUE <- function(YieldN, Nloss) {
  denom <- YieldN + Nloss
  if (any(denom == 0)) stop("Total N (Yield + Loss) cannot be zero.")
  return(YieldN / denom)
}

Try the NUETON package in your browser

Any scripts or data that you put into this service are public.

NUETON documentation built on Dec. 18, 2025, 1:07 a.m.