diff --git a/.github/.gitignore b/.github/.gitignore deleted file mode 100644 index 2d19fc7..0000000 --- a/.github/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.html diff --git a/.github/workflows/bookdown-build-and-deploy.yml b/.github/workflows/bookdown-build-and-deploy.yml new file mode 100644 index 0000000..27a4e52 --- /dev/null +++ b/.github/workflows/bookdown-build-and-deploy.yml @@ -0,0 +1,16 @@ +name: Déploiement de parcours_r_module6_publications_reproductibles + +on: + push: + branches: + - main + - master + + workflow_dispatch: + +jobs: + build-and-deploy-bookdown: + name: Build and bookdown + uses: MTES-MCT/parcours-r/.github/workflows/bookdown-build-from-desc-and-deploy.yml@master + with: + r_version: '4.4.1' diff --git a/.github/workflows/bookdown-build.yml b/.github/workflows/bookdown-build.yml new file mode 100644 index 0000000..ebbff51 --- /dev/null +++ b/.github/workflows/bookdown-build.yml @@ -0,0 +1,14 @@ +name: Test compilation de parcours_r_module6_publications_reproductibles + +on: + pull_request: + branches: [main, master, dev, dev-ci, 36-CI] + + workflow_dispatch: + +jobs: + build-bookdown: + name: Build bookdown + uses: MTES-MCT/parcours-r/.github/workflows/bookdown-build-from-desc.yml@master + with: + r_version: '4.4.1' diff --git a/.github/workflows/deploy_bookdown.yml b/.github/workflows/deploy_bookdown.yml deleted file mode 100644 index 700a0fe..0000000 --- a/.github/workflows/deploy_bookdown.yml +++ /dev/null @@ -1,78 +0,0 @@ -on: - push: - branches: - - main - - master - -env: - RENV_PATHS_ROOT: ~/.local/share/renv - - -name: renderbook - -jobs: - bookdown: - name: Render-Book - runs-on: macOS-latest - steps: - - - name: Checkout repo - uses: actions/checkout@v2 - - - name: Setup R - uses: r-lib/actions/setup-r@master - - - name: Install pandoc - run: | - brew install pandoc - - - name: Cache Renv packages - uses: actions/cache@v2 - with: - path: $HOME/.local/share/renv - key: r-${{ hashFiles('renv.lock') }} - restore-keys: r- - - - name: Cache bookdown results - uses: actions/cache@v2 - with: - path: _bookdown_files - key: bookdown-${{ hashFiles('**/*Rmd') }} - restore-keys: bookdown- - - - name: Install packages - run: | - R -e 'install.packages("renv")' - R -e 'renv::restore()' - - - name: Build site - run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)' - - - uses: actions/upload-artifact@v1 - with: - name: _book - path: _book/ - -# Need to first create an empty gh-pages branch -# see https://pkgdown.r-lib.org/reference/deploy_site_github.html -# and also add secrets for a GH_PAT and EMAIL to the repository -# gh-action from Cecilapp/GitHub-Pages-deploy - checkout-and-deploy: - runs-on: ubuntu-latest - needs: bookdown - steps: - - name: Checkout - uses: actions/checkout@master - - name: Download artifact - uses: actions/download-artifact@v1.0.0 - with: - # Artifact name - name: _book # optional - # Destination path - path: _book # optional - - name: Deploy to GitHub Pages - uses: Cecilapp/GitHub-Pages-deploy@master - env: - EMAIL: ${{ secrets.EMAIL }} # must be a verified email - GH_TOKEN: ${{ secrets.GH_PAT }} # https://github.com/settings/tokens - BUILD_DIR: _book/ # "_site/" by default diff --git a/.github/workflows/rstudio-image-build.yml b/.github/workflows/rstudio-image-build.yml new file mode 100644 index 0000000..1f30a17 --- /dev/null +++ b/.github/workflows/rstudio-image-build.yml @@ -0,0 +1,31 @@ +name: Image docker parcours_r_module6_publications_reproductibles + +on: + push: + branches: + - main + - master + - dev + - 36-CI + paths: + - .github/workflows/rstudio-image-build.yml + - Dockerfile + - DESCRIPTION + + pull_request: + types: + - created + branches: + - main + - master + - dev + paths: + - .github/workflows/rstudio-image-build.yml + - Dockerfile + - DESCRIPTION + + workflow_dispatch: + +jobs: + build-rstudio-image: + uses: MTES-MCT/parcours-r/.github/workflows/rstudio-image-build.yml@master diff --git a/.gitignore b/.gitignore index c30d1ca..6276962 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ _book _bookdown_files *.html -support-documents-reproductibles.Rmd \ No newline at end of file +support-documents-reproductibles.Rmd +archives_docs_compiles/ diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..21ff96d --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,42 @@ +Type: Book +Package: Parcours-R-M6 +Title: Parcours R M6 Publications Reproductibles avec RMarkdown +Version: 0.1.0 +Description: Valise pédagogique pour le module 6 du parcours R : Publications Reproductibles avec RMarkdown +License: MIT +URL: https://github.com/MTES-MCT/parcours_r_module_publication_rmarkdown +Encoding: UTF-8 +RoxygenNote: 7.2.3 +Imports: + COVID19, + dplyr, + COGiter, + emo, + ggplot2, + gouvdown, + gouvdown.fonts, + glue, + htmltools, + kableExtra, + knitr, + lubridate, + metathis, + pagedown, + readr, + rmarkdown, + savoirfR, + scales, + showtext, + stringi, + tidyr, + tidyverse, + tinytex, + xaringan, + xaringanExtra, + xaringanthemer +Remotes: + hadley/emo, + MaelTheuliere/COGiter, + MTES-MCT/savoirfR, + spyrales/gouvdown, + spyrales/gouvdown.fonts diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b4202c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +ARG R_VERSION=4.4.1 + +FROM inseefrlab/onyxia-rstudio:r${R_VERSION} +RUN apt-get update && apt-get install -y cargo +RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))" +COPY DESCRIPTION DESCRIPTION +RUN R -e 'remotes::install_deps(dependencies = TRUE)' diff --git a/_bookdown.yml b/_bookdown.yml index 1bb5eb6..f556294 100644 --- a/_bookdown.yml +++ b/_bookdown.yml @@ -1,4 +1,4 @@ -book_filename: "support-documents-reproductibles" +book_filename: "M6_Publications_reproductibles_avec_RMarkdown" delete_merged_file: TRUE language: ui: diff --git a/_output.yml b/_output.yml deleted file mode 100644 index 7ea874f..0000000 --- a/_output.yml +++ /dev/null @@ -1,16 +0,0 @@ -bookdown::gitbook: - css: 'assets/style.css' - config: - toc: - before: | -
  • -

    - -

    -
  • -
  • - Revenir au site Rmarkdown ... -
  • - after: > -
  • Liste des formations R
  • -
  • Published with bookdown
  • diff --git a/env-setup.R b/env-setup.R deleted file mode 100644 index ba05bab..0000000 --- a/env-setup.R +++ /dev/null @@ -1,17 +0,0 @@ -renv::activate() # facultatif, nécessite 'renv' - -needed_packages <- c( - - 'bookdown', - 'tidyverse', - 'devtools', - 'rmarkdown', - 'kableExtra' - -) - - -install.packages(needed_packages) - -devtools::install_github("hadley/emo") - diff --git a/src/rmd/report_examples/covid-report.Rmd b/src/rmd/report_examples/covid-report.Rmd deleted file mode 100644 index 8c6cef8..0000000 --- a/src/rmd/report_examples/covid-report.Rmd +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "Rapport Covid 19" -author: "Guillaume RRRozier" -date: "26/05/2021" -output: html_document -params: - country_name: "France" ---- - -```{r setup, include=FALSE, warning = FALSE,message = FALSE,results='hide'} -knitr::opts_chunk$set(echo = FALSE, warning = FALSE,message = FALSE) -``` - -## Vaccination - -```{r lib,results='hide'} -library(dplyr) -library(ggplot2) -library(lubridate) -library(COVID19) -data <- covid19() - -``` - - -```{r viz} -library('tidyr') - -data %>% - filter(administrative_area_level_1 == params$country_name, - lubridate::year(date) == 2021) %>% - mutate( - vacnb = as.numeric(people_vaccinated), - vacnbf = as.numeric(people_fully_vaccinated), - ) %>% - pivot_longer(cols=c(vacnb,vacnbf), names_to='type', values_to='nb') %>% - ggplot() + - geom_line(aes(x = date, y = nb, color=type)) + - theme_minimal() + - scale_y_continuous(labels = scales::number_format(big.mark = " ")) + - labs(color='Personnes') + - scale_color_discrete(labels=c('vaccinées', 'totalement vaccinées')) + - labs(title = glue::glue("Evolution du nombre de personnes vaccinées contre la COVID-19 en {params$country_name}"), y = NULL) -``` - - -# Pour en savoir plus ... - - - Les variables accessibles dans le modèle de données utilisé sont décrites en ligne dans le [dictionnaire des variables](https://covid19datahub.io/articles/docs.html). - - Ainsi que la présentation du 'package' [COVID19](https://rviews.rstudio.com/2021/12/08/the-r-package-covid19/) diff --git a/src/rmd/report_examples/covid-report2.Rmd b/src/rmd/report_examples/covid-report2.Rmd deleted file mode 100644 index 055b9fc..0000000 --- a/src/rmd/report_examples/covid-report2.Rmd +++ /dev/null @@ -1,61 +0,0 @@ ---- -author: "Guillaume RRRozier" -date: "26/05/2021" -output: html_document -params: - country_name: "France" ---- - -```{r setup, include=FALSE, warning = FALSE,message = FALSE,results='hide'} -knitr::opts_chunk$set(echo = FALSE, warning = FALSE,message = FALSE) -``` - -## Vaccination - -```{r lib,results='hide'} -library(dplyr) -library(ggplot2) -library(lubridate) -library(COVID19) -data <- covid19() - - -``` - -```{r titre, echo = FALSE} -titre <- data %>% - filter(administrative_area_level_1 == params$country_name, - !is.na(people_fully_vaccinated) - ) %>% - filter(date == max(date)) -titre_valeur <- format(titre$people_fully_vaccinated, big.mark = " ") -titre_date <- format(titre$date,format = "%A %d %B %Y") -``` - ---- -title: "Rapport Covid 19 - `r titre_valeur` personnes présentant un schéma de vaccination complet au `r titre_date` en `r params$country_name`" ---- - -```{r viz} -data %>% - filter(administrative_area_level_1 == params$country_name, - lubridate::year(date) > 2020) %>% - mutate( - vacnb = as.numeric(people_vaccinated), - vacnbf = as.numeric(people_fully_vaccinated), - ) %>% - tidyr::pivot_longer(cols=c(vacnb,vacnbf), names_to='type', values_to='nb') %>% - ggplot() + - geom_line(aes(x = date, y = nb, color=type)) + - theme_minimal() + - scale_y_continuous(labels = scales::number_format(big.mark = " ")) + - labs(color='Personnes') + - scale_color_discrete(labels=c('vaccinées', 'totalement vaccinées')) + - labs(title = glue::glue("Evolution du nombre de personnes vaccinées contre la COVID-19 en {params$country_name}"), y = NULL) -``` - - -# Pour en savoir plus ... - - - Les variables accessibles dans le modèle de données utilisé sont décrites en ligne dans le [dictionnaire des variables](https://covid19datahub.io/articles/docs.html). - - Ainsi que la présentation du 'package' [COVID19](https://rviews.rstudio.com/2021/12/08/the-r-package-covid19/)