Skip to contents

Function to return LakeCat metrics using the StreamCat API. The function allows a user to get specific metric data aggregated by area of interest, returned by comid(s), hydroregion(s), state(s), or county(ies).

Usage

lc_get_data(
  metric = NULL,
  aoi = NULL,
  comid = NULL,
  showAreaSqKm = NULL,
  showPctFull = NULL,
  countOnly = NULL
)

Arguments

metric

Name(s) of metrics to query Syntax: name=<name1>,<name2>

aoi

Specify the area of interest described by a metric. By default, all available areas of interest for a given metric are returned. Syntax: areaOfInterest=<value1>,<value2> Values: catchment|watershed|

comid

Return metric information for specific COMIDs. Needs to be a character string and function will convert to this format if needed. Syntax: comid=<comid1>,<comid2>

showAreaSqKm

Return the area in square kilometers of a given area of interest. The default value is false. Values: true|false

showPctFull

Return the pctfull for each dataset. The default value is false. Values: true|false

countOnly

Return a CSV containing only the row count (ROWCOUNT) and the column count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. Values: true|false

Value

A tibble of desired StreamCat metrics

Author

Marc Weber

Examples

# \donttest{
df <- lc_get_data(comid='23794487', aoi='catchment', metric='fert')
#> Rows: 1 Columns: 4
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (4): COMID, WSAREASQKM, CATAREASQKM, FERTCAT
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.

df <- lc_get_data(metric='PctUrbMd2006', aoi='watershed',
comid='24083377')
#> Rows: 1 Columns: 3
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (3): COMID, WSAREASQKM, PCTURBMD2006WS
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.

df <- lc_get_data(metric='PctUrbMd2006', aoi='watershed',
comid='24083377', showAreaSqKm=FALSE, showPctFull=TRUE)
#> Rows: 1 Columns: 4
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (4): COMID, WSAREASQKM, PCTURBMD2006WS, nlcd2006.WsPctFull
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.

df <- lc_get_data(metric='PctUrbMd2006,DamDens',
aoi='catchment,watershed', comid='23783629,23794487,23812618')
#> Rows: 3 Columns: 7
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (7): COMID, WSAREASQKM, CATAREASQKM, PCTURBMD2006CAT, PCTURBMD2006WS, DA...
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.

df <- lc_get_data(metric='PctUrbMd2006,DamDens',
aoi='catchment,watershed', comid='23783629,23794487,23812618',
countOnly=TRUE)
#> Rows: 1 Columns: 2
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): ROWCOUNT, COLUMNCOUNT
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.

 # }