library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(tidyr)
library(ggplot2)
stns <- c("08NH130", "08NH005")
dly_data <- hy_daily_flows(station_number = stns) %>%
left_join(
hy_stations(station_number = stns) %>%
select(STATION_NUMBER, DRAINAGE_AREA_GROSS),
by = "STATION_NUMBER") %>%
mutate(RO = Value / DRAINAGE_AREA_GROSS * 86400 / 1e6 * 1e3)
#> Error in hy_daily_flows(station_number = stns): could not find function "hy_daily_flows"
data <- dly_data %>% select(STATION_NUMBER, Date, RO) %>% spread(STATION_NUMBER, RO)
#> Error in eval(lhs, parent, parent): object 'dly_data' not found
colnames(data) <- c("Date", "Kaslo", "Fry")
#> Error in `colnames<-`(`*tmp*`, value = c("Date", "Kaslo", "Fry")): attempt to set 'colnames' on an object with less than two dimensions
ggplot(data) +
geom_point(aes(Kaslo , Fry))+
labs(x = "Mean daily runoff - Kaslo [mm/d]",
y = "Mean daily runoff - Fry [mm/d]")
#> Error: You're passing a function as global data.
#> Have you misspelled the `data` argument in `ggplot()`
A la:
Created on 2019-02-01 by the reprex package (v0.2.1)
It also might be interesting to contrast some SQL code which does this same thing and compare speeds.