Code
%>%
t_5404 filter(year == "2019") %>%
select(-year) %>%
mutate(value = round(value) %>% paste0(" Mds€")) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
Data - INSEE
%>%
t_5404 filter(year == "2019") %>%
select(-year) %>%
mutate(value = round(value) %>% paste0(" Mds€")) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
t_5404 filter(year == "2019",
grepl("A5", sector)) %>%
select(-year) %>%
mutate(value = round(value) %>% paste0(" Mds€")) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
t_5404 filter(year == "2019",
grepl("A17", sector)) %>%
select(-year) %>%
mutate(value = round(value) %>% paste0(" Mds€")) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
t_5404 filter(year == "2019",
grepl("A38", sector)) %>%
select(-year) %>%
mutate(value = round(value) %>% paste0(" Mds€")) %>%
if (is_html_output()) datatable(., filter = 'top', rownames = F) else .} {
%>%
t_5404 filter(sector %in% c("TOTAL", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(TOTAL.no.DE = TOTAL - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
ggplot(.) + theme_minimal() + ylab("Importations (% du PIB)") + xlab("") +
geom_line(aes(x = date, y = value/gdp, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.35, 0.9)) +
scale_x_date(breaks = seq(1950, 2020, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 0.01*seq(0, 100, 2),
labels = scales::percent_format(accuracy = 1))
%>%
t_5404 filter(sector %in% c("TOTAL", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(TOTAL.no.DE = TOTAL - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
filter(date >= as.Date("1980-01-01")) %>%
ggplot(.) + theme_minimal() + ylab("Importations (% du PIB)") + xlab("") +
geom_line(aes(x = date, y = value/gdp, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.35, 0.9)) +
scale_x_date(breaks = seq(1950, 2020, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 0.01*seq(0, 100, 2),
labels = scales::percent_format(accuracy = 1))
%>%
t_5404 filter(sector %in% c("TOTAL", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(TOTAL.no.DE = TOTAL - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
filter(date >= as.Date("2000-01-01")) %>%
ggplot(.) + theme_minimal() + ylab("Importations (% du PIB)") + xlab("") +
geom_line(aes(x = date, y = value/gdp, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.35, 0.9)) +
scale_x_date(breaks = seq(1950, 2020, 2) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 0.01*seq(0, 100, 2),
labels = scales::percent_format(accuracy = 1))
%>%
t_5404 filter(sector %in% c("A5.BE", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(A21.C = A5.BE - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
ggplot(.) + theme_minimal() + ylab("Importations (% du PIB)") + xlab("") +
geom_line(aes(x = date, y = value/gdp, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.35, 0.9)) +
scale_x_date(breaks = seq(1950, 2020, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 0.01*seq(0, 100, 2),
labels = scales::percent_format(accuracy = 1))
%>%
t_5404 filter(sector %in% c("A5.BE", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(A21.C = A5.BE - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
filter(date >= as.Date("1980-01-01")) %>%
ggplot(.) + theme_minimal() + ylab("Importations (% du PIB)") + xlab("") +
geom_line(aes(x = date, y = value/gdp, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.92)) +
scale_x_date(breaks = seq(1950, 2020, 2) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 0.01*seq(0, 100, 0.5),
labels = scales::percent_format(accuracy = 0.1))
%>%
t_5404 filter(sector %in% c("A5.BE", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(A21.C = A5.BE - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
filter(date >= as.Date("2000-01-01")) %>%
ggplot(.) + theme_minimal() + ylab("Importations (% du PIB)") + xlab("") +
geom_line(aes(x = date, y = value/gdp, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.92)) +
scale_x_date(breaks = seq(1950, 2020, 2) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 0.01*seq(0, 100, 0.5),
labels = scales::percent_format(accuracy = 0.1))
%>%
t_5404 filter(sector %in% c("A5.BE", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(A21.C = A5.BE - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
filter(date >= as.Date("1980-01-01")) %>%
ggplot(.) + theme_minimal() + ylab("Importations") + xlab("") +
geom_line(aes(x = date, y = value, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.92)) +
scale_x_date(breaks = seq(1950, 2020, 2) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 100*seq(0, 100, 1),
labels = scales::dollar_format(prefix = "", suffix = " Mds€", accuracy = 1))
%>%
t_5404 filter(sector %in% c("A5.BE", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(A21.C = A5.BE - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
filter(date >= as.Date("1980-01-01")) %>%
ggplot(.) + theme_minimal() + ylab("Importations") + xlab("") +
geom_line(aes(x = date, y = value, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.92)) +
scale_x_date(breaks = seq(1950, 2020, 2) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = 100*seq(0, 100, 1),
labels = scales::dollar_format(prefix = "", suffix = " Mds€", accuracy = 1))
%>%
t_5404 filter(sector %in% c("A5.BE", "A17.DE")) %>%
select(-Sector) %>%
spread(sector, value) %>%
mutate(A21.C = A5.BE - A17.DE) %>%
select(-A17.DE) %>%
mutate(date = paste0(year, "-01-01") %>% as.Date) %>%
select(-year) %>%
gather(sector, value, -date) %>%
left_join(sector, by = "sector") %>%
left_join(gdp, by = "date") %>%
ggplot(.) + theme_minimal() + ylab("Importations") + xlab("") +
geom_line(aes(x = date, y = value, color = Sector, linetype = Sector)) +
theme(legend.title = element_blank(),
legend.position = c(0.3, 0.92)) +
scale_x_date(breaks = seq(1950, 2020, 5) %>% paste0("-01-01") %>% as.Date,
labels = date_format("%y")) +
scale_color_manual(values = viridis(3)[1:2]) +
scale_y_log10(breaks = c(1,2,5, 10, 20, 50, 100, 200, 500, 1000, 2000),
labels = scales::dollar_format(prefix = "", suffix = " Mds€", accuracy = 1))