Learn R Programming

manureshed (version 0.1.3)

agri_classify_nitrogen_custom: Classify Agricultural Nitrogen Status with Custom Efficiency Factor

Description

Classify spatial units based on nitrogen balance with user-specified efficiency factor. This function allows sensitivity analysis by varying the nitrogen efficiency assumption. The default value of 0.5 represents typical losses during nutrient cycling, uptake, and application, but regional conditions may warrant different values.

Usage

agri_classify_nitrogen_custom(
  data,
  cropland_threshold,
  scale = "huc8",
  n_efficiency = 0.5
)

Value

Data frame with nitrogen classification added

Arguments

data

Data frame with processed agricultural data

cropland_threshold

Numeric. Threshold for excluding small cropland areas

scale

Character. Spatial scale for within-unit classification

n_efficiency

Numeric. Nitrogen efficiency factor (default: 0.5, range: 0-1)

Examples

Run this code
# \donttest{
# Load and process data first
nugis_data <- load_builtin_nugis("county", 2016)
processed_data <- agri_process_nugis(nugis_data, "county")
cropland_threshold <- 500 * 2.47105  # 500 ha in acres

# Standard analysis with default 0.5 efficiency
results_default <- agri_classify_nitrogen_custom(
  processed_data, cropland_threshold = cropland_threshold, n_efficiency = 0.5
)

# Sensitivity analysis with higher efficiency (e.g., improved management)
results_high <- agri_classify_nitrogen_custom(
  processed_data, cropland_threshold = cropland_threshold, n_efficiency = 0.7
)

# Conservative analysis with lower efficiency
results_low <- agri_classify_nitrogen_custom(
  processed_data, cropland_threshold = cropland_threshold, n_efficiency = 0.3
)

# Compare classification changes across efficiency scenarios
table(results_default$N_class)
table(results_high$N_class)
table(results_low$N_class)
# }

Run the code above in your browser using DataLab