--- title: "Unemployment rate" output: prettydoc::html_pretty: toc: true theme: architect highlight: github includes: # in_header: header.html vignette: > %\VignetteIndexEntry{Unemployment rate} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} %\VignetteDepends{kableExtra,magrittr,htmltools} --- ```{r setup,echo=FALSE, include=FALSE} # setup chunk NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")),"true") knitr::opts_chunk$set(purl = NOT_CRAN) library(insee) embed_png <- function(path, dpi = NULL) { meta <- attr(png::readPNG(path, native = TRUE, info = TRUE), "info") if (!is.null(dpi)) meta$dpi <- rep(dpi, 2) knitr::asis_output(paste0( "" ))} ``` ```{r message=FALSE, warning=FALSE, include=FALSE} library(kableExtra) library(htmltools) library(prettydoc) ``` ```{r, echo = FALSE} embed_png("unem.png") ``` ```{r message=FALSE, warning = FALSE, eval = FALSE} library(ggplot2) library(dplyr) library(magrittr) library(insee) dataset_list = get_dataset_list() df_idbank_list_selected = get_idbank_list("CHOMAGE-TRIM-NATIONAL") %>% #Unemployment dataset add_insee_title() %>% filter(INDICATEUR == "CTTXC") %>% #unemployment rate based on ILO standards filter(REF_AREA == "FM") %>% # all France excluding overseas departements filter(SEXE == 0) # men and women list_idbank = df_idbank_list_selected %>% pull(idbank) data = get_insee_idbank(list_idbank, startPeriod = "2000-01") %>% split_title() ggplot(data, aes(x = DATE, y = OBS_VALUE, colour = TITLE_EN2)) + geom_line() + geom_point() + ggtitle("French unemployment rate, by age") + labs(subtitle = sprintf("Last updated : %s", data$TIME_PERIOD[1])) ```