subsetHUC: Subset pre-formatted HUC files into smaller groupings.

Description Usage Arguments Value


A SpatialPolygons Dataframe is broken into smaller pieces based on HUC code or state. The SpatialPolygons Dataframe must have the required fields 'stateCode', 'HUC', and 'allStateCodes' and is intended to come from the convertUSGSHUC function. The difference between stateCode and allStateCodes is that stateCode has just one two-digit ISO code while allStateCodes can have more than one. This allows us to include in the subset HUCs where part of the watershed is in the specified state even though the centroid is in a different state.


subsetHUC(SPDF, parentHUCs = NULL, stateCodes = NULL,
  allStateCodes = NULL)



a spatial polygons dataframe created using the convertUSGSHUC function


a character vector specifying one or more containing HUCs


a character vector specifying one or more containing states


similar to stateCode, but will also include HUCs who touch the state but whose centroid is in a different state.


a SpatialPolygons Dataframe subsetted to the appropriate specifications.

Search within the MazamaSpatialUtils package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.