Imports data from NWIS web service. This function gets the data from here: https://nwis.waterdata.usgs.gov/nwis/qwdata A list of parameter codes can be found here: https://nwis.waterdata.usgs.gov/nwis/pmcodes/ A list of statistic codes can be found here: https://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table
1 2 3 4 5 6 7 8 9
character of USGS site numbers. This is usually an 8 digit number
character that contains the code for a parameter group, or a character vector of 5-digit parameter codes. See Details.
character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates retrieval for the earliest possible record. Date arguments are always specified in local time.
character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates retrieval for the latest possible record. Date arguments are always specified in local time.
logical defaults to
logical, reshape the expanded data. If
character to set timezone attribute of dateTime. Default is "UTC", and converts the
date times to UTC, properly accounting for daylight savings times based on the data's provided tz_cd column.
Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles",
"America/Anchorage", as well as the following which do not use daylight savings time: "America/Honolulu",
"America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla". See also
Valid parameter code groups are "All," or group codes:
|INM||Inorganics, Major, Metals|
|INN||Inorganics, Major, Non-metals|
|IMN||Inorganics, Minor, Non-metals|
|IMM||Inorganics, Minor, Metals|
If more than one parameter group is requested, only sites that data for all requested groups are returned.
A data frame with at least the following columns:
|agency_cd||character||The NWIS code for the agency reporting the data|
|site_no||character||The USGS site number|
|sample_dt||Date||The date the sample was collected|
|sample_tm||character||The reported sample collection time|
|startDateTime||POSIXct||Combining sample_dt and sample_tm, a date/time column is created, and converted into UTC (unless the tz argument specifies a different time zone)|
|endDateTime||POSIXct||If any sample_end_dt and sample_end_dt exist, this column is created similar to startDateTime|
Further columns will be included depending on the requested output format (expanded = TRUE or FALSE). Columns that end in "_reported" are the originally reported timezones, but the "tz_cd" column defines the timezone of any POSIXct columns.
There are also several useful attributes attached to the data frame:
|url||character||The url used to generate the data|
|queryTime||POSIXct||The time the data was returned|
|comment||character||Header comments from the RDB file|
|siteInfo||data frame||A data frame containing information on the requested sites|
|variableInfo||data frame||A data frame containing information on the requested parameters|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.