source("R/99-load-all-rds-test.R", echo = TRUE)
##
## > library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.6 v dplyr 1.0.8
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
##
## > library(agrometR)
##
## > d <- map_df(dir("data/rds", full.names = TRUE), readRDS)
##
## > scales::comma(nrow(d))
## [1] "28,751,876"
##
## > summarise(d, across(.cols = fecha_hora, .fns = list(min = min,
## + max = max)))
## # A tibble: 1 x 2
## fecha_hora_min fecha_hora_max
## <dttm> <dttm>
## 1 2010-01-01 00:00:00 2022-04-24 12:00:00
##
## > count(count(d, station_id))
## # A tibble: 1 x 1
## n
## <int>
## 1 417
##
## > dr <- left_join(summarise(group_by(d, station_id),
## + across(.cols = fecha_hora, .fns = list(min = min, max = max))),
## + estaciones_agromet, .... [TRUNCATED]
##
## > dr
## # A tibble: 417 x 10
## station_id fecha_hora_min fecha_hora_max institucion nombre_ema
## <dbl> <dttm> <dttm> <chr> <chr>
## 1 1 2010-01-01 00:00:00 2022-04-24 10:00:00 FDF Azapa1
## 2 2 2010-01-01 00:00:00 2022-04-24 10:00:00 FDF Azapa2
## 3 3 2010-01-01 00:00:00 2022-04-24 08:00:00 FDF Tranque Lauta~
## 4 4 2013-01-01 00:00:00 2022-04-24 10:00:00 FDF Jotabeche
## 5 5 2013-01-01 00:00:00 2022-04-24 10:00:00 FDF Hornitos
## 6 6 2013-01-01 00:00:00 2022-04-24 09:00:00 FDF Copiapo
## 7 7 2013-01-01 00:00:00 2022-04-24 08:00:00 FDF Bodega
## 8 8 2010-01-01 00:00:00 2022-04-24 09:00:00 FDF Vallenar
## 9 9 2010-01-01 00:00:00 2022-04-24 10:00:00 FDF Alto del Carm~
## 10 10 2013-01-01 00:00:00 2022-04-24 11:00:00 FDF El Palqui
## # ... with 407 more rows, and 5 more variables: comuna <chr>, region <chr>,
## # latitud <dbl>, longitud <dbl>, fecha_de_alta <dttm>
##
## > p <- ggplot(dr) + geom_segment(aes(y = as.character(station_id),
## + yend = as.character(station_id), x = fecha_hora_min, xend = fecha_hora_max, .... [TRUNCATED]
##
## > p

##
## > p + facet_wrap(vars(institucion))

##
## > p + facet_wrap(vars(region))

##
## > ggplot(gather(select(filter(d, station_id == 11),
## + -station_id), key, value, -fecha_hora), aes(fecha_hora, value)) +
## + geom_line() + geom .... [TRUNCATED]
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
## Warning: Removed 202047 rows containing non-finite values (stat_smooth).
