|
7 | 7 | #' @author |
8 | 8 | #' Marc Weber |
9 | 9 | #' |
10 | | -#' @param metric Name(s) of metrics to query. This is a comma delimited list of metrics or |
11 | | -#' or if metric='all' then all metrics will be queried. |
| 10 | +#' @param metric Name(s) of metrics to query. Must be character string with comma-delimited list of metrics, |
| 11 | +#' or, if \code{metric='all'} then all metrics will be queried. \emph{\strong{Not} case-sensitive}. |
12 | 12 | #' Syntax: name=<name1>,<name2> |
13 | 13 | #' |
14 | | -#' @param aoi Specify the area of interest described by a metric. For riparian area (catrp100 and wsrp100) |
15 | | -#' if the metric does not have data for the riparian area, no data is returned for that AOI. |
16 | | -#' Certain metrics have no AOI specified for StreamCat so AOI needs to be left null. These |
17 | | -#' metrics are: BankfullDepth, BankfullWidth, CHEM_V2_1, CONN, HABT, HYD, ICI, IWI, TEMP, WettedWidth, |
18 | | -#' prg_bmmi, and all the mast, msst, mwst metrics |
| 14 | +#' @param aoi Name(s) of areas of interest to query. |
| 15 | +#' If a metric does not have data for a given AOI, no data is returned for that AOI. |
| 16 | +#' Certain metrics that have no AOI specified for StreamCat need the AOI to be specified as \code{'other'}. These |
| 17 | +#' metrics include: BankfullDepth, BankfullWidth, ThalwagDepth (sic), CHEM_V2_1, CONN, HABT, HYD, ICI, IWI, TEMP, WettedWidth, |
| 18 | +#' prg_bmmi, and all the mast, msst, mwst metrics. \emph{Case-sensitive}. |
19 | 19 | #' |
20 | 20 | #' Syntax: areaOfInterest=<value1>,<value2> |
21 | | -#' Values: cat|ws|catrp100|wsrp100 |
| 21 | +#' Values: cat|ws|catrp100|wsrp100|other |
22 | 22 | #' |
23 | | -#' @param comid Return metric information for specific COMIDs. Needs to be a character string |
24 | | -#' and function will convert to this format if needed. |
| 23 | +#' @param comid Return metric information for specific COMIDs. Can be a comma-delimited list, a character vector, |
| 24 | +#' or any object that can be coerced to a comma-delimited list with \code{\link[base]{paste}}. |
| 25 | +#' One of \code{comid}, \code{county}, \code{state}, or \code{region} is required unless \code{conus='true'}. |
25 | 26 | #' Syntax: comid=<comid1>,<comid2> |
26 | 27 | #' |
27 | 28 | #' @param state Return metric information for COMIDs within a specific state. Use a state's abbreviation to |
28 | | -#' query for a given state. |
| 29 | +#' query for a given state. One of \code{comid}, \code{county}, \code{state}, or \code{region} is required unless \code{conus='true'}. |
| 30 | +#' If specified \emph{and valid}, \code{comid} and \code{county} are ignored. \emph{Case-sensitive}. |
29 | 31 | #' Syntax: state=<state1>,<state2> |
30 | 32 | #' |
31 | 33 | #' @param county Return metric information for COMIDs within a specific county. |
32 | 34 | #' Users must use the FIPS code, not county name, as a way to disambiguate counties. |
| 35 | +#' One of \code{comid}, \code{county}, \code{state}, or \code{region} is required unless \code{conus='true'}. If specified \emph{and valid}, \code{comid} is ignored. |
33 | 36 | #' Syntax: county=<county1>,<county1> |
34 | 37 | #' |
35 | 38 | #' @param region Return metric information for COMIDs within a specified hydroregion. |
36 | | -#' Hydroregions are specified using full name i.e. 'Region01', 'Region03N', 'Region10L' |
| 39 | +#' Hydroregions are specified using full name i.e. \code{'Region01'}, \code{'Region03N'}, \code{'Region10L'} |
| 40 | +#' One of \code{comid}, \code{county}, \code{state}, or \code{region} is required unless \code{conus='true'}. |
| 41 | +#' If specified \emph{and valid}, \code{comid}, \code{county}, and \code{state} are ignored. \emph{Case-sensitive}. |
37 | 42 | #' Syntax: region=<regionid1>,<regionid2> |
38 | 43 | #' |
39 | | -#' @param conus Return all COMIDs in the conterminous United States. |
40 | | -#' The default value is false. |
| 44 | +#' @param conus Return all COMIDs in the conterminous United States. Character string (\emph{\strong{Not} case-sensitive}) or logical. |
| 45 | +#' The default value is false. If true, \code{comid}, \code{county}, \code{state}, and \code{region} are ignored. |
41 | 46 | #' Values: true|false |
42 | 47 | #' |
43 | 48 | #' @param showAreaSqKm Return the area in square kilometers of a given area of interest. |
|
51 | 56 | #' count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. |
52 | 57 | #' Values: true|false |
53 | 58 | #' |
54 | | -#' @return A data frame of StreamCat metrics |
| 59 | +#' @return A data frame of StreamCat metrics. If data are missing for all rows of a given metric, then the column for that metric will not exist. If data are missing for only some rows, then they will be specified with NA. |
55 | 60 | #' |
56 | 61 | #' @examples |
57 | 62 | #' \donttest{ |
|
74 | 79 | #' df <- sc_get_data(metric='pcturbmd2006,damdens', |
75 | 80 | #' aoi='cat,ws', comid='179,1337,1337420', countOnly='true') |
76 | 81 | #' |
77 | | -#' df <- sc_get_data(metric='thalwagdepth', comid='179,1337,1337420',aoi='other') |
| 82 | +#' df <- sc_get_data(metric='thalwagdepth', comid='179,1337,1337420', aoi='other') |
| 83 | +#' |
| 84 | +#' df <- sc_get_data(metric='thalwagdepth', comid=c('179','1337','1337420'), aoi='other') |
78 | 85 | #' |
79 | 86 | #' df <- sc_get_data(comid='179', aoi='ws', metric='all') |
80 | 87 | #' } |
@@ -115,7 +122,7 @@ sc_get_data <- function(comid = NULL, |
115 | 122 | aoi <- gsub('riparian_watershed','wsrp100',aoi) |
116 | 123 | } |
117 | 124 | } |
118 | | - if ((is.null(comid) & is.null(state) & is.null(county) & is.null(region) & is.null(conus)) | is.null(metric) |is.null(aoi)){ |
| 125 | + if ((is.null(comid) & is.null(state) & is.null(county) & is.null(region) & is.null(conus)) | is.null(metric) | is.null(aoi)){ |
119 | 126 | stop('Must provide at a minimum valid comid, metric and aoi to the function') |
120 | 127 | } |
121 | 128 | if (!is.null(conus) & metric=='all'){ |
|
0 commit comments