Code
t_2104_2018 <- read_parquet("t_2104_2018_old.parquet")
load_data("insee/CNA-2014-PIB.RData")
nber_recessions <- read_parquet(here::here("data", "us", "nber_recessions.parquet"))Données - INSEE
t_2104_2018 <- read_parquet("t_2104_2018_old.parquet")
load_data("insee/CNA-2014-PIB.RData")
nber_recessions <- read_parquet(here::here("data", "us", "nber_recessions.parquet"))
t_2104_2018 |>
group_by(line, Line) |>
summarise(Nobs = n()) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}gdp <- `CNA-2014-PIB` |>
yearend_to_date() |>
filter(OPERATION == "PIB",
UNIT_MEASURE %in% c("EUROS_COURANTS")) |>
mutate(value = (OBS_VALUE |> as.numeric())/1000,
variable = paste0("PIB_", UNIT_MEASURE),
variable_desc = "Produit Intérieur Brut") |>
select(date, value)gdp |>
mutate(value = round(value) |> paste0(" Mds€")) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}t_2104_2018 |>
filter(date == as.Date("2018-12-31")) |>
select(-date) |>
mutate(value = round(value) |> paste0(" Mds€")) %>%
{if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}t_2104_2018 |>
group_by(date) |>
mutate(value = value/value[line == 18]) |>
filter(line %in% c(5, 4)) |>
ggplot() + theme_minimal() +
geom_line(aes(x = date, y = value, color = Line, linetype = Line)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.9)) +
geom_rect(data = nber_recessions |>
filter(Peak > as.Date("1949-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
limits = c(1949, 2020) |> paste0("-01-01") |> as.Date(),
labels = date_format("%Y")) +
ylab("% du RDBA") + xlab("") +
scale_color_manual(values = viridis(5)[1:4]) +
scale_y_continuous(breaks = 0.01*seq(0, 100, 5),
labels = scales::percent_format(accuracy = 1))
t_2104_2018 |>
group_by(date) |>
mutate(value = value/value[line == 18]) |>
filter(line %in% c(2, 3)) |>
ggplot() + theme_minimal() +
geom_line(aes(x = date, y = value, color = Line, linetype = Line)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.9)) +
geom_rect(data = nber_recessions |>
filter(Peak > as.Date("1949-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
limits = c(1949, 2020) |> paste0("-01-01") |> as.Date(),
labels = date_format("%Y")) +
ylab("% du RDBA") + xlab("") +
scale_color_manual(values = viridis(5)[1:4]) +
scale_y_continuous(breaks = 0.01*seq(0, 100, 5),
labels = scales::percent_format(accuracy = 1))
t_2104_2018 |>
group_by(date) |>
mutate(value = value/value[line == 18]) |>
filter(line %in% c(9)) |>
ggplot() + theme_minimal() +
geom_line(aes(x = date, y = value, color = Line, linetype = Line)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.9)) +
geom_rect(data = nber_recessions |>
filter(Peak > as.Date("1949-01-01")),
aes(xmin = Peak, xmax = Trough, ymin = -Inf, ymax = +Inf),
fill = 'grey', alpha = 0.5) +
scale_x_date(breaks = seq(1950, 2100, 5) |> paste0("-01-01") |> as.Date(),
limits = c(1949, 2020) |> paste0("-01-01") |> as.Date(),
labels = date_format("%Y")) +
ylab("% du RDBA") + xlab("") +
scale_color_manual(values = viridis(5)[1:4]) +
scale_y_continuous(breaks = 0.01*seq(0, 100, 1),
labels = scales::percent_format(accuracy = 1))