library(opensignauxfaibles)
library(dplyr)
library(ggplot2)
database_signauxfaibles <- database_connect()

Table effectif

tbl(database_signauxfaibles, "table_effectif") %>%
  collect(n = 5) %>%
  glimpse()
tbl(database_signauxfaibles, "table_effectif") %>%
  count(period) %>%
  collect() %>%
  mutate(date = lubridate::ymd(paste0(period, "-01"))) %>%
  arrange(desc(date))

Activité partielle consommée

tbl(database_signauxfaibles, "table_apart_consommee") %>%
  collect() %>% 
  glimpse()
tbl(database_signauxfaibles, "table_apart_consommee") %>%
  filter(is.na(date) == FALSE) %>%
  group_by(date) %>% 
  summarise(
    heures_consommees = sum(heures_consommees, na.rm = TRUE)
    ) %>%
  collect() %>%
  mutate(year = lubridate::year(date)) %>%
  ggplot() + 
    geom_col(
      mapping = aes(x = date, y = heures_consommees), 
      col = "white"
    ) 

Table CCSV

Répartition des plan CCSF par mois

tbl(src = database_signauxfaibles, "table_ccsv") %>%
  collect() %>%
  mutate(ym = lubridate::ymd(
    paste0(
      lubridate::year(date_creation), "-",
      lubridate::month(date_creation),
      "-01")
      )
    ) %>%
  count(ym) %>%
  ggplot() +
  geom_col(
    mapping = aes(x = ym, y = n)
    ) +
  scale_x_date()

Table des débits

dplyr::tbl(database_signauxfaibles, "table_debit") %>%
  filter(periodicity == "monthly") %>%
  dplyr::count(period) %>%
  dplyr::collect()   %>%
  dplyr::mutate(date = lubridate::ymd(paste0(period, "-01"))) %>%
  dplyr::arrange(desc(date)) %>%
  ggplot2::ggplot() +
  ggplot2::geom_col(
    mapping = aes(x = date, y = n),
    col = "white"
    ) +
  ggplot2::scale_x_date(
    limits = lubridate::ymd(c("2010-01-01", "2017-12-01"))
    )


SGMAP-AGD/opensignauxfaibles documentation built on May 15, 2019, 1:26 p.m.