knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This vignette shows how to use the package's internal data sets.
library(hydroscoper) library(tibble) library(ggplot2)
There are three data sets stored in the package. stations
is comprised of the stations' id, name, longitude, latitude, etc.
stations
timeseries
of the time series' id, the corresponding station, variable type, time step etc.
timeseries
greece_borders
is a data-frame for use with the function geom_polygon
from the ggplot2
package.
stations
and greece_borders
can be used to create a map with all Hydroscope's stations. Unfortunately, there is a number of them that have erroneous coordinates (over the sea and far from Greece). Also, there are 120 stations with missing coordinates.
ggplot() + geom_polygon(data = greece_borders, aes(long, lat, group = group), fill = "grey", color = NA) + geom_point(data = stations, aes(x = longitude, y = latitude, color = subdomain)) + scale_color_manual(values=c("#E64B35FF", "#4DBBD5FF", "#00A087FF", "#3C5488FF"))+ coord_fixed(ratio=1) + theme_bw()
The location of the stations with time series available to download are presented at the following map.
stations_ts <- subset(stations, station_id %in% timeseries$station_id & subdomain %in% c("kyy", "ypaat")) ggplot() + geom_polygon(data = greece_borders, aes(long, lat, group = group), fill = "grey", color = NA) + geom_point(data = stations_ts, aes(x = longitude, y = latitude, color = subdomain)) + scale_color_manual(values=c("#00A087FF", "#3C5488FF"))+ coord_fixed(ratio=1) + theme_bw()
Although there is a large number of stations with available data, there is heterogeneity in the coverage of the country.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.