knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "tools/readme/README-", out.width = "100%" )
A wrapper for querying KISTERS WISKI databases via the KiWIS API. Users can toggle between various databases by specifying the hub
argument. Currently, the default hubs are:
All data is returned as tidy tibbles.
You can install kiwisR
from CRAN:
install.packages('kiwisR')
To install the development version of kiwisR
you first need to install devtools
.
if(!requireNamespace("devtools")) install.packages("devtools") devtools::install_github('rywhale/kiwisR')
Then load the package with
library(kiwisR)
devtools::load_all()
By default, ki_station_list()
returns a tibble containing information for all available stations for the selected hub.
# With swmc as the hub ki_station_list(hub = 'swmc')
You can use the station_id
column returned using ki_station_list()
to figure out
which time series are available for a given station.
# Single station_id available_ts <- ki_timeseries_list( hub = 'swmc', station_id = "144659" ) available_ts
If you provide a vector to station_id
, the returned tibble will have all the
available time series from all stations. They can be differentiated using the
station_name
column.
# Vector of station_ids my_station_ids <- c("144659", "144342") available_ts <- ki_timeseries_list( hub = 'swmc', station_id = my_station_ids ) available_ts
You can now use the ts_id
column in the tibble produced by ki_timeseries_list()
to query values for
chosen time series.
By default this will return values for the past 24 hours. You can specify the dates you're interested in
by setting start_date
and end_date
. These should be set as date strings with the format 'YYYY-mm-dd'.
You can pass either a single or multiple ts_id
(s).
# Past 24 hours my_values <- ki_timeseries_values( hub = 'swmc', ts_id = '966435042' ) my_values
# Specified date, multiple time series my_ts_ids <- c("1125831042","908195042") my_values <- ki_timeseries_values( hub = 'swmc', ts_id = my_ts_ids, start_date = "2015-08-28", end_date = "2018-09-13" ) my_values
You can use this package for a KiWIS hub not included in this list by feeding the location of the API service to the hub
argument.
For instance: If your URL looks like
http://kiwis.kisters.de/KiWIS/KiWIS?datasource=0&service=kisters&type=queryServices&request=getrequestinfo
specify the hub
argument with
http://kiwis.kisters.de/KiWIS/KiWIS?
If you'd like to have a hub added to the defaults, please Submit an Issue
See here if you'd like to contribute.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.