GroupSLCClasses: Calculate grouped sums for SLC classes in a GeoData file

View source: R/function_GroupSLCClasses.R

GroupSLCClassesR Documentation

Calculate grouped sums for SLC classes in a GeoData file

Description

GroupSLCClasses calculates grouped sums for SLC classes (area fractions or absolute areas) based on land use, soil, or crop groups in a GeoClass table, or any other user-provided grouping index.

Usage

GroupSLCClasses(
  gd,
  gcl = NULL,
  type = c("landuse", "soil", "crop"),
  group = NULL,
  abs.area = FALSE,
  verbose = TRUE
)

Arguments

gd

Data frame containing columns with SUBIDs, SLC fractions, and SUBID areas if abs.area = TRUE. Typically a 'GeoData.txt' file imported with ReadGeoData.

gcl

Data frame containing columns with SLCs and corresponding landuse and soil class IDs, typically a 'GeoClass.txt' file imported with ReadGeoClass. Must be provided if no group argument is given.

type

Character string keyword for use with gcl. Type of grouping index, either "landuse", "soil", or "crop", can be abbreviated.

group

Integer vector, of same length as number of SLC classes in gd. Alternative grouping index specification to gcl + type.

abs.area

Logical, if TRUE, then absolute areas will be calculated for each group, rather than area fractions.

verbose

Logical, if TRUE then information and progress bar will be printed.

Details

If absolute areas are calculated, area units will correspond to areas provided in gd.

Value

GroupSLClasses returns the data frame with SUBIDs, SUBID areas, and grouped SLC class columns.

Examples

# Import source data
te1 <- ReadGeoData(filename = system.file("demo_model", "GeoData.txt", package = "HYPEtools"))
te2 <- ReadGeoClass(filename = system.file("demo_model", "GeoClass.txt", package = "HYPEtools"))
# Calculate soil groups
GroupSLCClasses(gd = te1, gcl = te2, type = "s")


HYPEtools documentation built on Sept. 11, 2024, 8:34 p.m.