Learn R Programming

manureshed (version 0.1.3)

agri_classify_phosphorus_custom: Classify Agricultural Phosphorus Status with Custom Efficiency Factor

Description

Classify spatial units based on phosphorus balance with user-specified efficiency factor. While standard phosphorus classification uses 100\ allows sensitivity analysis by varying the phosphorus efficiency assumption for different management scenarios or application methods.

Usage

agri_classify_phosphorus_custom(
  data,
  cropland_threshold,
  scale = "huc8",
  p_efficiency = 1
)

Value

Data frame with phosphorus 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

p_efficiency

Numeric. Phosphorus efficiency factor (default: 1.0, 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 1.0 efficiency (100%)
results_default <- agri_classify_phosphorus_custom(
  processed_data, cropland_threshold = cropland_threshold, p_efficiency = 1.0
)

# Analysis with reduced efficiency (e.g., accounting for losses)
results_reduced <- agri_classify_phosphorus_custom(
  processed_data, cropland_threshold = cropland_threshold, p_efficiency = 0.8
)

# Conservative analysis with lower efficiency
results_conservative <- agri_classify_phosphorus_custom(
  processed_data, cropland_threshold = cropland_threshold, p_efficiency = 0.6
)

# Compare classification changes across efficiency scenarios
table(results_default$P_class)
table(results_reduced$P_class)
table(results_conservative$P_class)
# }

Run the code above in your browser using DataLab