View source: R/realtime-webservice.R
realtime_ws | R Documentation |
Function to actually retrieve data from ECCC web service. The maximum number of days that can be queried depends on other parameters being requested. If one station is requested, 18 months of data can be requested. If you continually receiving errors when invoking this function, reduce the number of observations (via station_number, parameters or dates) being requested.
realtime_ws(
station_number,
parameters = NULL,
start_date = Sys.Date() - 30,
end_date = Sys.Date()
)
station_number |
Water Survey of Canada station number. |
parameters |
parameter ID. Can take multiple entries. Parameter is a numeric code. See |
start_date |
Accepts either YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. If only start date is supplied (i.e. YYYY-MM-DD) values are returned from the start of that day. Defaults to 30 days before current date. Time is supplied in UTC. |
end_date |
Accepts either YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. If only a date is supplied (i.e. YYYY-MM-DD) values are returned from the end of that day. Defaults to current date. Time is supplied in UTC. |
A tibble with 6 variables:
Unique 7 digit Water Survey of Canada station number
Observation date and time. Formatted as a POSIXct class as UTC for consistency.
Code name in English
Value of the measurement.
Value units
future use
future use
future use
Numeric parameter code
Letter parameter code
Other realtime functions:
realtime_dd()
,
realtime_stations()
## Not run:
ws_08 <- realtime_ws(
station_number = c("08NL071", "08NM174"),
parameters = c(47, 5)
)
fivedays <- realtime_ws(
station_number = c("08NL071", "08NM174"),
parameters = c(47, 5),
end_date = Sys.Date(), # today
start_date = Sys.Date() - 5 # five days ago
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.