Learn R Programming

manureshed (version 0.1.2)

save_spatial_data: Save Spatial Data

Description

Save spatial data to RDS file with standardized naming

Usage

save_spatial_data(
  data,
  file_path = NULL,
  scale = "huc8",
  nutrient = "both",
  analysis_type = "combined",
  year = format(Sys.Date(), "%Y")
)

Value

Character. Path to saved file

Arguments

data

sf object. Spatial data to save

file_path

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

scale

Character. Spatial scale for file naming

nutrient

Character. Nutrient type for file naming ("nitrogen", "phosphorus", or "both")

analysis_type

Character. Analysis type for file naming

year

Numeric. Year for file naming

Examples

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

# Save with auto-generated filename
save_spatial_data(results$agricultural, scale = "county", year = 2016)

# Save with custom filename
save_spatial_data(results$agricultural,
                  file.path(tempdir(), "my_results.rds"))
# }

Run the code above in your browser using DataLab