From 7aa1e9aeb37e14f3b47047b0c8775bfdd75fce24 Mon Sep 17 00:00:00 2001 From: Tanguy BARTHELEMY Date: Wed, 4 Oct 2023 15:14:45 +0200 Subject: [PATCH] lintr project --- .github/workflows/lint-project.yml | 31 +++++++++ .lintr | 5 +- doc/Fiche_1_Installation_des_outils_FR.Rmd | 68 +++++++++---------- doc/Sheet_1_Tools_installation_EN.Rmd | 67 +++++++++--------- ...eet_1_simplified_Tools_installation_EN.Rmd | 33 +++++---- doc/render.R | 6 +- 6 files changed, 120 insertions(+), 90 deletions(-) create mode 100644 .github/workflows/lint-project.yml diff --git a/.github/workflows/lint-project.yml b/.github/workflows/lint-project.yml new file mode 100644 index 0000000..b133489 --- /dev/null +++ b/.github/workflows/lint-project.yml @@ -0,0 +1,31 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] +pull_request: + branches: [main, master] + +name: lint-project + +jobs: + lint-project: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install lintr + run: install.packages("lintr", repos = "http://cran.us.r-project.org") + shell: Rscript {0} + + - name: Lint root directory + run: lintr::lint_dir() + shell: Rscript {0} + env: + LINTR_ERROR_ON_LINT: true diff --git a/.lintr b/.lintr index 45c9a2e..aea46e8 100644 --- a/.lintr +++ b/.lintr @@ -1,4 +1,5 @@ linters: with_defaults( line_length_linter = NULL, - trailing_blank_lines_linter = NULL -) \ No newline at end of file + trailing_blank_lines_linter = NULL, + indentation_linter(indent = 4L), + commented_code_linter = NULL) diff --git a/doc/Fiche_1_Installation_des_outils_FR.Rmd b/doc/Fiche_1_Installation_des_outils_FR.Rmd index 7eb0a6b..0c1e886 100644 --- a/doc/Fiche_1_Installation_des_outils_FR.Rmd +++ b/doc/Fiche_1_Installation_des_outils_FR.Rmd @@ -11,6 +11,7 @@ output: number_sections: TRUE highlight: "arrow" latex_engine: xelatex + keep_tex: true html_document: df_print: paged number_sections: TRUE @@ -29,29 +30,28 @@ knitr::opts_chunk$set(echo = TRUE) html_color <- "#000cff" windows_path_color <- "#006817" -colFmt <- function(x, color, url = TRUE) { +color_format <- function(x, color, url = TRUE) { color_name <- deparse(substitute(color)) - outputFormat <- knitr::opts_knit$get("rmarkdown.pandoc.to") - + output_format <- knitr::opts_knit$get("rmarkdown.pandoc.to") + x <- x |> gsub(pattern = "\\", replacement = "\\\\", fixed = TRUE) - - if (outputFormat == 'latex') { + + if (output_format == "latex") { x <- x |> gsub(pattern = "#", replacement = "\\#", fixed = TRUE) ret <- paste("\\textcolor{", color_name, ifelse(url, "}{\\url{", "}{\\nolinkurl{"), x, ifelse(url, "}}", "}}"), sep = "") - } else if (outputFormat == 'html') { + } else if (output_format == "html") { ret <- paste("", x, "", sep = "") - } else if (outputFormat == "gfm+tex_math_dollars-yaml_metadata_block") { + } else if (output_format == "gfm+tex_math_dollars-yaml_metadata_block") { if (url) { ret <- paste("[", x, "](", x, ")", sep = "") } else { - # ret <- x |> gsub(pattern = "\\\\", replacement = " \\backslash ", fixed = TRUE) ret <- x |> gsub(pattern = "\\", replacement = "\\\\", fixed = TRUE) ret <- paste("${\\textsf{\\color{", color, "}{", ret, "}}}$", sep = "") } } else { ret <- x } - + return(ret) } ``` @@ -79,7 +79,7 @@ Les outils d'aide à la désaisonnalisation sont : # Préalable {-} -Sur les ordinateurs sans droits d'administrateur (*postes professionnels par exemple*), il est conseillé de créer un dossier **Software** sous `r colFmt("C:\\Users\\...\\Software", color = windows_path_color, url = FALSE)` ou directement sous `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)` dans lequel tous les logiciels seront installés. +Sur les ordinateurs sans droits d'administrateur (*postes professionnels par exemple*), il est conseillé de créer un dossier **Software** sous `r color_format("C:\\Users\\...\\Software", color = windows_path_color, url = FALSE)` ou directement sous `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)` dans lequel tous les logiciels seront installés. ⚠️ Attention : lorsqu'on précise un chemin **absolu** de logiciel (JDemetra+, Java, **R**, ...) dans un programme, un raccourci, une variable, ..., il doit être modifié à chaque fois qu’un des répertoires racines du logiciel est déplacé. @@ -90,7 +90,7 @@ JDemetra+ est une galerie de programmes Java servant à l'étude des séries tem ## Version de JDemetra+ et dépendances -JDemetra+ est téléchargeable depuis le lien [github](https://github.com/jdemetra/jdemetra-app/releases) de l'application : `r colFmt("https://github.com/jdemetra/jdemetra-app/releases", color = html_color, url = TRUE)`. +JDemetra+ est téléchargeable depuis le lien [github](https://github.com/jdemetra/jdemetra-app/releases) de l'application : `r color_format("https://github.com/jdemetra/jdemetra-app/releases", color = html_color, url = TRUE)`. La dernière release ([v2.2.4](https://github.com/jdemetra/jdemetra-app/releases/tag/v2.2.4)) date du 31 janvier 2023. C'est la dernière version **stable** de JDemetra+. **C'est cette version qu'il convient de télécharger et d'utiliser en production.** @@ -118,9 +118,9 @@ Deux solutions pour l'installer : ⚠️ Attention : pour la seconde option il faut **télécharger** le dossier compressé `jdemetra+-2.2.4-bin.zip` (pour la version 2.2.4 par exemple) et **non** le dossier `Source code (zip)`. -Le logiciel se trouve alors dans le dossier `r colFmt("\\nbdemetra\\bin\\", color = windows_path_color, url = FALSE)`, ce sont les fichiers `nbdemetra.exe` (version 32-bit) et `nbdemetra64.exe` (version 64-bit). +Le logiciel se trouve alors dans le dossier `r color_format("\\nbdemetra\\bin\\", color = windows_path_color, url = FALSE)`, ce sont les fichiers `nbdemetra.exe` (version 32-bit) et `nbdemetra64.exe` (version 64-bit). -ℹ️ Conseil : si vous comptez utiliser plusieurs version de JDemetra+ (v2.2.4, v3.0.2, ...), vous pouvez renommer les dossiers dézippés en `r colFmt("\\nbdemetra-2.2.4\\", color = windows_path_color, url = FALSE)` et `r colFmt("\\nbdemetra-3.0.2\\", color = windows_path_color, url = FALSE)`. +ℹ️ Conseil : si vous comptez utiliser plusieurs version de JDemetra+ (v2.2.4, v3.0.2, ...), vous pouvez renommer les dossiers dézippés en `r color_format("\\nbdemetra-2.2.4\\", color = windows_path_color, url = FALSE)` et `r color_format("\\nbdemetra-3.0.2\\", color = windows_path_color, url = FALSE)`. ℹ️ Remarque : Vous pouvez créer des raccourcis des exécutables si vous souhaitez les lancer depuis le bureau ou d'autres dossiers. @@ -131,12 +131,12 @@ Le cruncher ([**JWSACruncher**](https://github.com/jdemetra/jwsacruncher)) est u Pour utiliser le cruncher, il faut: -- **Télécharger** et **Dézipper** le fichier `jwsacruncher-2.2.4-bin.zip` de la dernière version **stable** (**Latest** v2.2.4 disponible ici `r colFmt("https://github.com/jdemetra/jwsacruncher/releases", color = html_color, url = TRUE)`) +- **Télécharger** et **Dézipper** le fichier `jwsacruncher-2.2.4-bin.zip` de la dernière version **stable** (**Latest** v2.2.4 disponible ici `r color_format("https://github.com/jdemetra/jwsacruncher/releases", color = html_color, url = TRUE)`) Si l’on utilise une version portable de Java (voir section [Installation Java](#install_java)), il faut encore modifier certains paramètres pour utiliser le cruncher : -- Dans le dossier dézippé, **ouvrir** (par exemple avec Notepad++) le fichier `jwsacruncher.bat` présent dans le sous-dossier `r colFmt("\\bin\\", color = windows_path_color, url = FALSE)` (c'est-à-dire sous `r colFmt("jdemetra-cli-2.2.4\\bin\\", color = windows_path_color, url = FALSE)` dans la version 2.2.4 du cruncher) -- **Modifier** la valeur de la variable `JAVACMD` de la ligne **71** (actuelle `JAVACMD=java`) par l’adresse vers le fichier `java.exe` de la version portable . Ainsi, si JPortable est installé sous `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)`, la nouvelle ligne est `if "%JAVACMD%"=="" set JAVACMD="C:\\Users\\Software\\Java64\\bin\\java"` (pour Java 8). +- Dans le dossier dézippé, **ouvrir** (par exemple avec Notepad++) le fichier `jwsacruncher.bat` présent dans le sous-dossier `r color_format("\\bin\\", color = windows_path_color, url = FALSE)` (c'est-à-dire sous `r color_format("jdemetra-cli-2.2.4\\bin\\", color = windows_path_color, url = FALSE)` dans la version 2.2.4 du cruncher) +- **Modifier** la valeur de la variable `JAVACMD` de la ligne **71** (actuelle `JAVACMD=java`) par l’adresse vers le fichier `java.exe` de la version portable . Ainsi, si JPortable est installé sous `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)`, la nouvelle ligne est `if "%JAVACMD%"=="" set JAVACMD="C:\\Users\\Software\\Java64\\bin\\java"` (pour Java 8). # Installation de Java {#install_java} @@ -145,7 +145,7 @@ Si l’on utilise une version portable de Java (voir section [Installation Java] ## Java 8 -Pour installer Java 8, utiliser le lien `r colFmt("https://portableapps.com/apps/utilities/java_portable", color = html_color, url = TRUE)`. Si l’on utilise la version 64-bit de +Pour installer Java 8, utiliser le lien `r color_format("https://portableapps.com/apps/utilities/java_portable", color = html_color, url = TRUE)`. Si l’on utilise la version 64-bit de JDemetra+, il faut bien installer la version jPortable 64-bit (en bas de la page). @@ -159,10 +159,10 @@ En revanche, pour utiliser les packages R en version 3 sans télécharger la GUI ### Installation -Pour installer Java 17, il faut aller à l'adresse `r colFmt("https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html", color = html_color, url = TRUE)`. +Pour installer Java 17, il faut aller à l'adresse `r color_format("https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html", color = html_color, url = TRUE)`. -- **Télécharger** la version `Compressed Archive` de Windows (`r colFmt("https://download.oracle.com/java/17/archive/jdk-17.0.4.1_windows-x64_bin.zip", color = html_color, url = TRUE)`) -- **Dézipper** le dossier `r colFmt("jdk-17.0.6", color = windows_path_color, url = FALSE)` sous `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)` (*par exemple*) +- **Télécharger** la version `Compressed Archive` de Windows (`r color_format("https://download.oracle.com/java/17/archive/jdk-17.0.4.1_windows-x64_bin.zip", color = html_color, url = TRUE)`) +- **Dézipper** le dossier `r color_format("jdk-17.0.6", color = windows_path_color, url = FALSE)` sous `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)` (*par exemple*) Après avoir installé Java (en version 8, 17 ou autre), il faut : @@ -172,24 +172,24 @@ Après avoir installé Java (en version 8, 17 ou autre), il faut : # Installation de **R** et Rstudio Les fonctionnalités de JDemetra+ sont accessibles sur **R** via des packages **R**. -Pour utiliser **R**, mieux vaut utiliser un IDE donc Rstudio. Tous les exécutables à télécharger sont sous `r colFmt("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`. +Pour utiliser **R**, mieux vaut utiliser un IDE donc Rstudio. Tous les exécutables à télécharger sont sous `r color_format("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`. ## Installation de **R** Pour installer **R**, il faut : -- **Télécharger** le fichier binaire `R-4.3.1-win.exe` sous `r colFmt("https://cran.rstudio.com/bin/windows/base/", color = html_color, url = TRUE)` +- **Télécharger** le fichier binaire `R-4.3.1-win.exe` sous `r color_format("https://cran.rstudio.com/bin/windows/base/", color = html_color, url = TRUE)` - **Exécuter** l'exécutable pour paramétrer et installer **R**. ## Installation de Rstudio -**Télécharger** la dernière version de Rstudio (sous `r colFmt("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`) et l'**installer**. +**Télécharger** la dernière version de Rstudio (sous `r color_format("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`) et l'**installer**. Si l'installation via le fichier `.exe` échoue (car nécessite des droits supérieurs (administrateur, élévation, ...), nous allons récupérer une version portable du logiciel. Pour cela : -- **Télécharger** et **dézipper** le dossier compressé `.zip` dans un dossier Rstudio (sous `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)`) +- **Télécharger** et **dézipper** le dossier compressé `.zip` dans un dossier Rstudio (sous `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)`) - **Créer un raccourci** du fichier `rstudio.exe` sur le Bureau @@ -208,11 +208,11 @@ Les packages en version 2 sont les suivants : | Nom | Disponible sur le CRAN | Disponible sur AUS | Lien Github | |---|--|--|-----| -| RJDemetra | ✔️ | ✔️ | `r colFmt("https://github.com/jdemetra/rjdemetra", color = html_color, url = TRUE)` | -| rjdworkspace | ❌ | ✔️ | `r colFmt("https://github.com/InseeFrLab/rjdworkspace", color = html_color, url = TRUE)` | -| JDCruncheR | ❌ | ✔️ | `r colFmt("https://github.com/InseeFr/JDCruncheR", color = html_color, url = TRUE)` | -| rjwsacruncher | ✔️ | ✔️ | `r colFmt("https://github.com/AQLT/rjwsacruncher", color = html_color, url = TRUE)` | -| rjdmarkdown | ✔️ | ✔️ | `r colFmt("https://github.com/AQLT/rjdmarkdown", color = html_color, url = TRUE)` | +| RJDemetra | ✔️ | ✔️ | `r color_format("https://github.com/jdemetra/rjdemetra", color = html_color, url = TRUE)` | +| rjdworkspace | ❌ | ✔️ | `r color_format("https://github.com/InseeFrLab/rjdworkspace", color = html_color, url = TRUE)` | +| JDCruncheR | ❌ | ✔️ | `r color_format("https://github.com/InseeFr/JDCruncheR", color = html_color, url = TRUE)` | +| rjwsacruncher | ✔️ | ✔️ | `r color_format("https://github.com/AQLT/rjwsacruncher", color = html_color, url = TRUE)` | +| rjdmarkdown | ✔️ | ✔️ | `r color_format("https://github.com/AQLT/rjdmarkdown", color = html_color, url = TRUE)` | Le code d'installation des packages est ci-dessous : @@ -263,7 +263,7 @@ remotes::install_github("AQLT/ggdemetra3") Pour installer un package sur AUS, il n'est pas possible d'utiliser la fonction `install_github()`{.r}. Ainsi, si le package n'est pas sur le CRAN ni sur le nexus d'AUS, il doit être téléchargé au format binaire. Pour cela, il faut aller chercher le dossier compressé `.zip` sous GitHub. -Exemple pour le package **rjd3toolkit**, le `Source code (tar.gz)` se trouve sous `r colFmt("https://github.com/rjdemetra/rjd3toolkit/releases/tag/v3.0.2", color = html_color, url = TRUE)` (*release* Section). Après l'avoir récupéré, il faut lancer la commande d'installation : +Exemple pour le package **rjd3toolkit**, le `Source code (tar.gz)` se trouve sous `r color_format("https://github.com/rjdemetra/rjd3toolkit/releases/tag/v3.0.2", color = html_color, url = TRUE)` (*release* Section). Après l'avoir récupéré, il faut lancer la commande d'installation : ```{r, echo = TRUE, eval = FALSE} install.packages("path/.../rjd3toolkit_3.0.2.tar.gz ", @@ -354,9 +354,9 @@ Lorsque vous installer un nouveau logiciel *(exemple JDemetra+, Rtools, Java...) - **Récupérer** l'actuelle valeur de la variable `PATH` via la commande `Sys.getenv("PATH")`{.r} (Rstudio renvoie alors une succession d'adresse du type `C:/WINDOWS/system32;C:/WINDOWS`) -- **Copier-coller** ces adresses après `PATH = ` et y ajouter les chemins vers les répertoires `r colFmt("\\bin\\", color = windows_path_color, url = FALSE)` (binary) des logiciels nouvellement installés, en les séparant par des points-virgules sans espace avant ni après. +- **Copier-coller** ces adresses après `PATH = ` et y ajouter les chemins vers les répertoires `r color_format("\\bin\\", color = windows_path_color, url = FALSE)` (binary) des logiciels nouvellement installés, en les séparant par des points-virgules sans espace avant ni après. - Par exemple, pour l'installation de Rtools, le chemin est `r colFmt("C:\\rtools42\\mingw64\\bin", color = windows_path_color, url = FALSE)` (selon là où a été installé Rtools). Il faut donc rajouter `C:\\rtools42\\mingw64\\bin` ou `C:/rtools42/mingw64/bin` (En **R**, `\` est un caractère spécial, donc il faut remplacer les `\` par `/` ou par `\\`). Le chemin devient `C:/WINDOWS/system32;C:/WINDOWS;C:/rtools42/mingw64/bin`. + Par exemple, pour l'installation de Rtools, le chemin est `r color_format("C:\\rtools42\\mingw64\\bin", color = windows_path_color, url = FALSE)` (selon là où a été installé Rtools). Il faut donc rajouter `C:\\rtools42\\mingw64\\bin` ou `C:/rtools42/mingw64/bin` (En **R**, `\` est un caractère spécial, donc il faut remplacer les `\` par `/` ou par `\\`). Le chemin devient `C:/WINDOWS/system32;C:/WINDOWS;C:/rtools42/mingw64/bin`. - **Modifier** la variable avec la fonction `Sys.setenv()`{.r}. @@ -390,7 +390,7 @@ Selon le résultat, la version est 32 bits ou 64 bits : | | x86_32 | +------------+-------------+ -Plus d'informations sur la variable `PATH` via la page `r colFmt("https://java.com/fr/download/help/path.xml", color = html_color, url = TRUE)`. +Plus d'informations sur la variable `PATH` via la page `r color_format("https://java.com/fr/download/help/path.xml", color = html_color, url = TRUE)`. # Vérifications @@ -472,7 +472,7 @@ Deux solutions : install.packages("RJDemetra", type = "source", INSTALL_opts = "--no-multiarch") ``` -ℹ️ Plus d'information : `r colFmt("https://github.com/jdemetra/rjdemetra/wiki/Installation-manual", color = html_color, url = TRUE)` +ℹ️ Plus d'information : `r color_format("https://github.com/jdemetra/rjdemetra/wiki/Installation-manual", color = html_color, url = TRUE)` ## La commande `library("RJDemetra")`{.r} renvoie un message d’erreur diff --git a/doc/Sheet_1_Tools_installation_EN.Rmd b/doc/Sheet_1_Tools_installation_EN.Rmd index 8e30e9b..913c343 100644 --- a/doc/Sheet_1_Tools_installation_EN.Rmd +++ b/doc/Sheet_1_Tools_installation_EN.Rmd @@ -29,29 +29,28 @@ knitr::opts_chunk$set(echo = TRUE) html_color <- "#000cff" windows_path_color <- "#006817" -colFmt <- function(x, color, url = TRUE) { +color_format <- function(x, color, url = TRUE) { color_name <- deparse(substitute(color)) - outputFormat <- knitr::opts_knit$get("rmarkdown.pandoc.to") - + output_format <- knitr::opts_knit$get("rmarkdown.pandoc.to") + x <- x |> gsub(pattern = "\\", replacement = "\\\\", fixed = TRUE) - - if (outputFormat == 'latex') { + + if (output_format == "latex") { x <- x |> gsub(pattern = "#", replacement = "\\#", fixed = TRUE) ret <- paste("\\textcolor{", color_name, ifelse(url, "}{\\url{", "}{\\nolinkurl{"), x, ifelse(url, "}}", "}}"), sep = "") - } else if (outputFormat == 'html') { + } else if (output_format == "html") { ret <- paste("", x, "", sep = "") - } else if (outputFormat == "gfm+tex_math_dollars-yaml_metadata_block") { + } else if (output_format == "gfm+tex_math_dollars-yaml_metadata_block") { if (url) { ret <- paste("[", x, "](", x, ")", sep = "") } else { - # ret <- x |> gsub(pattern = "\\\\", replacement = " \\backslash ", fixed = TRUE) ret <- x |> gsub(pattern = "\\", replacement = "\\\\", fixed = TRUE) ret <- paste("${\\textsf{\\color{", color, "}{", ret, "}}}$", sep = "") } } else { ret <- x } - + return(ret) } ``` @@ -82,7 +81,7 @@ Thus, it is helpful to install the following tools: # Preliminary {-} -On the computers without administrator rights (*professional computer, for example*), it is recommended to create a folder **Software** under `r colFmt("C:\\Users\\...\\Software", color = windows_path_color, url = FALSE)` or directly under `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)` where all software will be installed. +On the computers without administrator rights (*professional computer, for example*), it is recommended to create a folder **Software** under `r color_format("C:\\Users\\...\\Software", color = windows_path_color, url = FALSE)` or directly under `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)` where all software will be installed. ⚠️ Warning: when we specify an **absolute** path for a software (JDemetra+, Java, **R**, ...) in a program, a shortcut, a variable, ..., it must be modified each time any root repository is moved. @@ -92,7 +91,7 @@ JDemetra+ is a collection of Java programs used for time series analysis and mor ## Version of JDemetra+ and dependencies -JDemetra+ is downloadable from the [github link](https://github.com/jdemetra/jdemetra-app/releases) of the application: `r colFmt("https://github.com/jdemetra/jdemetra-app/releases", color = html_color, url = TRUE)`. +JDemetra+ is downloadable from the [github link](https://github.com/jdemetra/jdemetra-app/releases) of the application: `r color_format("https://github.com/jdemetra/jdemetra-app/releases", color = html_color, url = TRUE)`. The last release ([v2.2.4](https://github.com/jdemetra/jdemetra-app/releases/tag/v2.2.3)) dates from January 31, 2023. It is the last **stable** version of JDemetra+. **This version should be downloaded and must be used in production.** @@ -119,9 +118,9 @@ There are two possibilities for installing: ⚠️ Warning: for the second option, you need to **download** the compressed folder `jdemetra+-2.2.4-bin.zip` (for the version 2.2.4 for example) and **not** the folder `Source code (zip)`. -The Software is in the folder `r colFmt("\\nbdemetra\\bin\\", color = windows_path_color, url = FALSE)`, these are the file `nbdemetra.exe` (version 32-bit) and `nbdemetra64.exe` (version 64-bit). +The Software is in the folder `r color_format("\\nbdemetra\\bin\\", color = windows_path_color, url = FALSE)`, these are the file `nbdemetra.exe` (version 32-bit) and `nbdemetra64.exe` (version 64-bit). -ℹ Advice: If you want to use several versions of JDemetra+ (v2.2.4, v3.0.2, ...), you can rename the unzipped folder in `r colFmt("\\nbdemetra-2.2.4\\", color = windows_path_color, url = FALSE)` and `r colFmt("\\nbdemetra-3.0.2\\", color = windows_path_color, url = FALSE)`. +ℹ Advice: If you want to use several versions of JDemetra+ (v2.2.4, v3.0.2, ...), you can rename the unzipped folder in `r color_format("\\nbdemetra-2.2.4\\", color = windows_path_color, url = FALSE)` and `r color_format("\\nbdemetra-3.0.2\\", color = windows_path_color, url = FALSE)`. ℹ️ Remark: You can create shortcuts to the executable files if you want to launch them from another folder (Desktop, project folder...). @@ -131,12 +130,12 @@ The cruncher ([**JWSACruncher**](https://github.com/jdemetra/jwsacruncher)) is a To use the cruncher, you have to: -- **Download** and **unzip** the file from the **latest stable** version v2.2.4 here `r colFmt("https://github.com/jdemetra/jwsacruncher/releases", color = html_color, url = TRUE)` +- **Download** and **unzip** the file from the **latest stable** version v2.2.4 here `r color_format("https://github.com/jdemetra/jwsacruncher/releases", color = html_color, url = TRUE)` If you want to install and use a portable Java version (See section [Java installation](#install_java)), you have to modify some parameters to use the cruncher: -- In the unzipped folder, **open** (for example with Notepad++) the file `jwsacruncher.bat` present in the subfolder `r colFmt("\\bin\\", color = windows_path_color, url = FALSE)` (that is under `r colFmt("jdemetra-cli-2.2.4\\bin\\", color = windows_path_color, url = FALSE)` in the version 2.2.3 of the cruncher) -- **Modify** the value of the variable `JAVACMD` at the line **71** (currently `JAVACMD=java`) by the address towards the file `java.exe` of the portable version. Then, if JPortable is installed under `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)`, the new line is `if "%JAVACMD%"=="" set JAVACMD="C:\\Users\\Software\\Java64\\bin\\java"` (for Java 8). +- In the unzipped folder, **open** (for example with Notepad++) the file `jwsacruncher.bat` present in the subfolder `r color_format("\\bin\\", color = windows_path_color, url = FALSE)` (that is under `r color_format("jdemetra-cli-2.2.4\\bin\\", color = windows_path_color, url = FALSE)` in the version 2.2.3 of the cruncher) +- **Modify** the value of the variable `JAVACMD` at the line **71** (currently `JAVACMD=java`) by the address towards the file `java.exe` of the portable version. Then, if JPortable is installed under `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)`, the new line is `if "%JAVACMD%"=="" set JAVACMD="C:\\Users\\Software\\Java64\\bin\\java"` (for Java 8). # Installation of Java {#install_java} @@ -145,7 +144,7 @@ If you want to install and use a portable Java version (See section [Java instal ## Java 8 -To install Java 8, use the link `r colFmt("https://portableapps.com/apps/utilities/java_portable", color = html_color, url = TRUE)`. If you use the version 64-bit of JDemetra+, you should install the version jPortable 64-bit (at the bottom of the page). +To install Java 8, use the link `r color_format("https://portableapps.com/apps/utilities/java_portable", color = html_color, url = TRUE)`. If you use the version 64-bit of JDemetra+, you should install the version jPortable 64-bit (at the bottom of the page). ## Java 17 @@ -159,10 +158,10 @@ On the other hand, to use R packages in version 3 without downloading the GUI (i ### Installation -To install Java 17, you need to head over to `r colFmt("https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html", color = html_color, url = TRUE)`. +To install Java 17, you need to head over to `r color_format("https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html", color = html_color, url = TRUE)`. -- **Download** the version `Compressed Archive` of Windows (`r colFmt("https://download.oracle.com/java/17/archive/jdk-17.0.4.1_windows-x64_bin.zip", color = html_color, url = TRUE)`) -- **Unzip** the folder `r colFmt("jdk-17.0.6", color = windows_path_color, url = FALSE)` under `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)` (for example) +- **Download** the version `Compressed Archive` of Windows (`r color_format("https://download.oracle.com/java/17/archive/jdk-17.0.4.1_windows-x64_bin.zip", color = html_color, url = TRUE)`) +- **Unzip** the folder `r color_format("jdk-17.0.6", color = windows_path_color, url = FALSE)` under `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)` (for example) After a Java installation (in version 8, 17 or other), you need to: @@ -172,24 +171,24 @@ After a Java installation (in version 8, 17 or other), you need to: # Installation of **R** and Rstudio The JDemetra+ features are available on **R** via **R** packages. -To use **R**, it is better to use an IDE like Rstudio. All the executable files to download are under `r colFmt("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`. +To use **R**, it is better to use an IDE like Rstudio. All the executable files to download are under `r color_format("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`. ## Installation of **R** To install **R**, you should: -- **Download** the binary file `R-4.3.1-win.exe` under `r colFmt("https://cran.rstudio.com/bin/windows/base/", color = html_color, url = TRUE)` +- **Download** the binary file `R-4.3.1-win.exe` under `r color_format("https://cran.rstudio.com/bin/windows/base/", color = html_color, url = TRUE)` - **Execute** the executable to parameter and install **R**. ## Installation of Rstudio -**Download** the last Rstudio version (under `r colFmt("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`) and the **installer**. +**Download** the last Rstudio version (under `r color_format("https://posit.co/download/rstudio-desktop/#download", color = html_color, url = TRUE)`) and the **installer**. If the installation via the file `.exe` fails (because it requires higher rights (administrator, elevation, ...), we will get a portable version of the Software. To do this: -- **Download** and **unzip** the compressed folder `.zip` in a folder named "Rstudio" (under `r colFmt("C:\\Users\\Software", color = windows_path_color, url = FALSE)`) +- **Download** and **unzip** the compressed folder `.zip` in a folder named "Rstudio" (under `r color_format("C:\\Users\\Software", color = windows_path_color, url = FALSE)`) - **Create a shortcut** of the file `rstudio.exe` on the Desktop. @@ -208,11 +207,11 @@ The packages in version 2 are: | Name | Available on CRAN | Available on AUS | Github link | |---|--|--|-----| -| RJDemetra | ✔️ | ✔️ | `r colFmt("https://github.com/jdemetra/rjdemetra", color = html_color, url = TRUE)` | -| rjdworkspace | ❌ | ✔️ | `r colFmt("https://github.com/InseeFrLab/rjdworkspace", color = html_color, url = TRUE)` | -| JDCruncheR | ❌ | ✔️ | `r colFmt("https://github.com/InseeFr/JDCruncheR", color = html_color, url = TRUE)` | -| rjwsacruncher | ✔️ | ✔️ | `r colFmt("https://github.com/AQLT/rjwsacruncher", color = html_color, url = TRUE)` | -| rjdmarkdown | ✔️ | ✔️ | `r colFmt("https://github.com/AQLT/rjdmarkdown", color = html_color, url = TRUE)` | +| RJDemetra | ✔️ | ✔️ | `r color_format("https://github.com/jdemetra/rjdemetra", color = html_color, url = TRUE)` | +| rjdworkspace | ❌ | ✔️ | `r color_format("https://github.com/InseeFrLab/rjdworkspace", color = html_color, url = TRUE)` | +| JDCruncheR | ❌ | ✔️ | `r color_format("https://github.com/InseeFr/JDCruncheR", color = html_color, url = TRUE)` | +| rjwsacruncher | ✔️ | ✔️ | `r color_format("https://github.com/AQLT/rjwsacruncher", color = html_color, url = TRUE)` | +| rjdmarkdown | ✔️ | ✔️ | `r color_format("https://github.com/AQLT/rjdmarkdown", color = html_color, url = TRUE)` | The packages installation code is below: @@ -263,7 +262,7 @@ remotes::install_github("AQLT/ggdemetra3") To install a package on AUS, you can't use the function `install_github()`{.r}. Therefore, if the package is not on CRAN and not on AUS, it must be downloaded at the binary format (`.zip`). For this you have to look for the compressed folder `.zip` under GitHub. -For the package **rjd3toolkit**, you need to search under `r colFmt("https://github.com/rjdemetra/rjd3toolkit/releases/tag/v3.0.2", color = html_color, url = TRUE)` (*release* Section) then launch the installation code: +For the package **rjd3toolkit**, you need to search under `r color_format("https://github.com/rjdemetra/rjd3toolkit/releases/tag/v3.0.2", color = html_color, url = TRUE)` (*release* Section) then launch the installation code: ```{r, echo = TRUE, eval = FALSE} install.packages("path/.../rjd3toolkit_3.0.2.tar.gz ", @@ -361,8 +360,8 @@ When you install a new software (for example JDemetra+, Rtools, Java...) that Rs - **Get** the actual value of the variable `PATH` via the **R** command `Sys.getenv("PATH")`{.r} (Rstudio returns a succession of addresses as `C:/WINDOWS/system32;C:/WINDOWS`) -- **Copy paste** this value after `PATH = ` and add the paths towards the folder `r colFmt("\\bin\\", color = windows_path_color, url = FALSE)` (binary) of the software newly installed, by separating them with semicolon (without space before or after). - For the Rtools installation, the path is `r colFmt("C:\\rtools42\\mingw64\\bin", color = windows_path_color, url = FALSE)` (depending on where Rtools was installed). You have to add `C:\\rtools42\\mingw64\\bin` or `C:/rtools42/mingw64/bin` (In **R**, `\` is a special character, so you have to replace the `\` by `/` or by `\\`). The path becomes `C:/WINDOWS/system32;C:/WINDOWS;C:/rtools42/mingw64/bin`. +- **Copy paste** this value after `PATH = ` and add the paths towards the folder `r color_format("\\bin\\", color = windows_path_color, url = FALSE)` (binary) of the software newly installed, by separating them with semicolon (without space before or after). + For the Rtools installation, the path is `r color_format("C:\\rtools42\\mingw64\\bin", color = windows_path_color, url = FALSE)` (depending on where Rtools was installed). You have to add `C:\\rtools42\\mingw64\\bin` or `C:/rtools42/mingw64/bin` (In **R**, `\` is a special character, so you have to replace the `\` by `/` or by `\\`). The path becomes `C:/WINDOWS/system32;C:/WINDOWS;C:/rtools42/mingw64/bin`. - **Modify** the variable with the function `Sys.setenv()`{.r}. For Rtools, the command to launch is: @@ -394,7 +393,7 @@ According to the result, the version is 32 bits or 64 bits : | | x86_32 | +------------+-------------+ -More information on the variable `PATH` via the page `r colFmt("https://java.com/fr/download/help/path.xml", color = html_color, url = TRUE)`. +More information on the variable `PATH` via the page `r color_format("https://java.com/fr/download/help/path.xml", color = html_color, url = TRUE)`. # Verifications @@ -476,7 +475,7 @@ There are two solutions: install.packages("RJDemetra", type = "source", INSTALL_opts = "--no-multiarch") ``` -ℹ️ More information: `r colFmt("https://github.com/jdemetra/rjdemetra/wiki/Installation-manual", color = html_color, url = TRUE)` +ℹ️ More information: `r color_format("https://github.com/jdemetra/rjdemetra/wiki/Installation-manual", color = html_color, url = TRUE)` ## The command `library("RJDemetra")`{.r} returns an error message diff --git a/doc/Sheet_1_simplified_Tools_installation_EN.Rmd b/doc/Sheet_1_simplified_Tools_installation_EN.Rmd index f68011e..07897dd 100644 --- a/doc/Sheet_1_simplified_Tools_installation_EN.Rmd +++ b/doc/Sheet_1_simplified_Tools_installation_EN.Rmd @@ -29,29 +29,28 @@ knitr::opts_chunk$set(echo = TRUE) html_color <- "#000cff" windows_path_color <- "#006817" -colFmt <- function(x, color, url = TRUE) { +color_format <- function(x, color, url = TRUE) { color_name <- deparse(substitute(color)) - outputFormat <- knitr::opts_knit$get("rmarkdown.pandoc.to") - + output_format <- knitr::opts_knit$get("rmarkdown.pandoc.to") + x <- x |> gsub(pattern = "\\", replacement = "\\\\", fixed = TRUE) - - if (outputFormat == 'latex') { + + if (output_format == "latex") { x <- x |> gsub(pattern = "#", replacement = "\\#", fixed = TRUE) ret <- paste("\\textcolor{", color_name, ifelse(url, "}{\\url{", "}{\\nolinkurl{"), x, ifelse(url, "}}", "}}"), sep = "") - } else if (outputFormat == 'html') { + } else if (output_format == "html") { ret <- paste("", x, "", sep = "") - } else if (outputFormat == "gfm+tex_math_dollars-yaml_metadata_block") { + } else if (output_format == "gfm+tex_math_dollars-yaml_metadata_block") { if (url) { ret <- paste("[", x, "](", x, ")", sep = "") } else { - # ret <- x |> gsub(pattern = "\\\\", replacement = " \\backslash ", fixed = TRUE) ret <- x |> gsub(pattern = "\\", replacement = "\\\\", fixed = TRUE) ret <- paste("${\\textsf{\\color{", color, "}{", ret, "}}}$", sep = "") } } else { ret <- x } - + return(ret) } ``` @@ -80,7 +79,7 @@ Thus, it is helpful to install the following tools: # Preliminary {-} -On the computers without administrator rights (*professional computer, for example*), it is recommended to create a folder **Software** under `r colFmt("C:\\Users\\...\\Software", windows_path_color, url = FALSE)` or directly under `r colFmt("C:\\Users\\Software", windows_path_color, url = FALSE)` where all software will be installed. +On the computers without administrator rights (*professional computer, for example*), it is recommended to create a folder **Software** under `r color_format("C:\\Users\\...\\Software", windows_path_color, url = FALSE)` or directly under `r color_format("C:\\Users\\Software", windows_path_color, url = FALSE)` where all software will be installed. ⚠️ Warning: when we specify an **absolute** path for a software (JDemetra+, Java, ...) in a program, a shortcut, a variable, ..., it must be modified each time any root repository is moved. @@ -90,7 +89,7 @@ JDemetra+ is a collection of Java programs used for time series analysis and mor ## Version of JDemetra+ and dependencies -JDemetra+ is downloadable from the [github link](https://github.com/jdemetra/jdemetra-app/releases) of the application: `r colFmt("https://github.com/jdemetra/jdemetra-app/releases", color = html_color, url = TRUE)`. +JDemetra+ is downloadable from the [github link](https://github.com/jdemetra/jdemetra-app/releases) of the application: `r color_format("https://github.com/jdemetra/jdemetra-app/releases", color = html_color, url = TRUE)`. The last release ([v2.2.4](https://github.com/jdemetra/jdemetra-app/releases/tag/v2.2.3)) dates from January 31, 2023. It is the last **stable** version of JDemetra+. **This version should be downloaded and must be used in production.** @@ -117,9 +116,9 @@ There are two possibilities for installing: ⚠️ Warning: for the second option, you need to **download** the compressed folder `jdemetra+-2.2.4-bin.zip` (for the version 2.2.4 for example) and **not** the folder `Source code (zip)`. -The Software is in the folder `r colFmt("\\nbdemetra\\bin\\", windows_path_color, url = FALSE)`, these are the file `nbdemetra.exe` (version 32-bit) and `nbdemetra64.exe` (version 64-bit). +The Software is in the folder `r color_format("\\nbdemetra\\bin\\", windows_path_color, url = FALSE)`, these are the file `nbdemetra.exe` (version 32-bit) and `nbdemetra64.exe` (version 64-bit). -ℹ Advice: If you want to use several versions of JDemetra+ (v2.2.4, v3.0.2, ...), you can rename the unzipped folder in `r colFmt("\\nbdemetra-2.2.4\\", windows_path_color, url = FALSE)` and `r colFmt("\\nbdemetra-3.0.2\\", windows_path_color, url = FALSE)`. +ℹ Advice: If you want to use several versions of JDemetra+ (v2.2.4, v3.0.2, ...), you can rename the unzipped folder in `r color_format("\\nbdemetra-2.2.4\\", windows_path_color, url = FALSE)` and `r color_format("\\nbdemetra-3.0.2\\", windows_path_color, url = FALSE)`. ℹ️ Remark: You can create shortcuts to the executable files if you want to launch them from another folder (Desktop, project folder...). @@ -129,12 +128,12 @@ The cruncher ([**JWSACruncher**](https://github.com/jdemetra/jwsacruncher)) is a To use the cruncher, you have to: -- **Download** and **unzip** the file from the **latest stable** version v2.2.4 here `r colFmt("https://github.com/jdemetra/jwsacruncher/releases", color = html_color, url = TRUE)` +- **Download** and **unzip** the file from the **latest stable** version v2.2.4 here `r color_format("https://github.com/jdemetra/jwsacruncher/releases", color = html_color, url = TRUE)` If you want to install and use a portable Java version (See section [Java installation](#install_java)), you have to modify some parameters to use the cruncher: -- In the unzipped folder, **open** (for example with Notepad++) the file `jwsacruncher.bat` present in the subfolder `r colFmt("\\bin\\", windows_path_color, url = FALSE)` (that is under `r colFmt("jdemetra-cli-2.2.4\\bin\\", windows_path_color, url = FALSE)` in the version 2.2.3 of the cruncher) -- **Modify** the value of the variable `JAVACMD` at the line **71** (currently `JAVACMD=java`) by the address towards the file `java.exe` of the portable version. Then, if JPortable is installed under `r colFmt("C:\\Users\\Software", windows_path_color, url = FALSE)`, the new line is `if "%JAVACMD%"=="" set JAVACMD="C:\\Users\\Software\\Java64\\bin\\java"` (for Java 8). +- In the unzipped folder, **open** (for example with Notepad++) the file `jwsacruncher.bat` present in the subfolder `r color_format("\\bin\\", windows_path_color, url = FALSE)` (that is under `r color_format("jdemetra-cli-2.2.4\\bin\\", windows_path_color, url = FALSE)` in the version 2.2.3 of the cruncher) +- **Modify** the value of the variable `JAVACMD` at the line **71** (currently `JAVACMD=java`) by the address towards the file `java.exe` of the portable version. Then, if JPortable is installed under `r color_format("C:\\Users\\Software", windows_path_color, url = FALSE)`, the new line is `if "%JAVACMD%"=="" set JAVACMD="C:\\Users\\Software\\Java64\\bin\\java"` (for Java 8). # Installation of Java {#install_java} @@ -143,7 +142,7 @@ If you want to install and use a portable Java version (See section [Java instal ## Java 8 -To install Java 8, use the link `r colFmt("https://portableapps.com/apps/utilities/java_portable", color = html_color, url = TRUE)`. If you use the version 64-bit of JDemetra+, you should install the version jPortable 64-bit (at the bottom of the page). +To install Java 8, use the link `r color_format("https://portableapps.com/apps/utilities/java_portable", color = html_color, url = TRUE)`. If you use the version 64-bit of JDemetra+, you should install the version jPortable 64-bit (at the bottom of the page). ## Java 17 diff --git a/doc/render.R b/doc/render.R index 9b51354..ab0b1eb 100644 --- a/doc/render.R +++ b/doc/render.R @@ -3,9 +3,9 @@ # Fiche 1 : Installation des outils -------------------------------------------- -rmarkdown::render("./doc/Fiche_1_Installation_des_outils_FR.Rmd", +rmarkdown::render("./doc/Fiche_1_Installation_des_outils_FR.Rmd", output_dir = "Fiches", output_format = "all") -rmarkdown::render("./doc/Sheet_1_Tools_installation_EN.Rmd", +rmarkdown::render("./doc/Sheet_1_Tools_installation_EN.Rmd", output_dir = "Sheets", output_format = "all") -rmarkdown::render("./doc/Sheet_1_simplified_Tools_installation_EN.Rmd", +rmarkdown::render("./doc/Sheet_1_simplified_Tools_installation_EN.Rmd", output_dir = "Sheets", output_format = "all")