Learn R Programming

manureshed (version 0.1.2)

save_centroid_data: Save Centroid Data

Description

Save centroid data to CSV file for transition probability analysis

Usage

save_centroid_data(
  data,
  file_path = NULL,
  scale = "huc8",
  nutrient = "nitrogen",
  analysis_type = "centroids",
  year = format(Sys.Date(), "%Y")
)

Value

Character. Path to saved file

Arguments

data

Data frame. Data with centroid coordinates

file_path

Character. Output file path (should end in .csv). If NULL, auto-generated

scale

Character. Spatial scale for file naming

nutrient

Character. Nutrient type for file naming

analysis_type

Character. Analysis type for file naming

year

Numeric. Year for file naming

Examples

Run this code
# \donttest{
# Create some example data first
results <- run_builtin_analysis(scale = "county", year = 2016, include_wwtp = TRUE)

# Save centroids for transition analysis
if ("integrated" %in% names(results) && "nitrogen" %in% names(results$integrated)) {
  centroids <- add_centroid_coordinates(results$integrated$nitrogen)
  save_centroid_data(centroids, scale = "county", nutrient = "nitrogen")
}
# }

Run the code above in your browser using DataLab