diff --git a/Module_correlation.Rmd b/Module_correlation.Rmd index 0bdc2ec8d3c44c19c2053c1a42f0d6e24f0b661c..87c492166141c42fbd9d00d1b9ce125b007b7a1e 100644 --- a/Module_correlation.Rmd +++ b/Module_correlation.Rmd @@ -3,32 +3,6 @@ title: '"Module d''analyse des corrélations des annotations des échantillons"' output: html_document --- - -```{r input_parameters, include=FALSE} -# Chemin vers le fichier de design -design_file <- "C:/Users/User/Desktop/projet_visualisation/design_WS3.csv" - -# Liste des noms de variables à considérer comme catégorielles. -categorical_vars <- c("sample", "condition", "animal", "experiment", "extraction") - -# Liste des noms de variables à considérer comme quantitatives. -quantitative_vars <- c( "volume", "quantity") - -# Liste des noms de variables à afficher pour la figure "matrice de plots" (advanced pairs plot). -# Ici, on exclut par exemple 'sample' pour ne pas surcharger la visualisation. -display_vars <- c("condition", "animal", "experiment", "extraction") -``` - - -```{r setup, include=FALSE} - -# Global options: hide code, warnings and messages in the final report. -knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) - -``` - - - ```{r load_packages, include=FALSE} # Installer et charger les packages nécessaires if(!require(GGally)) install.packages("GGally") @@ -60,50 +34,60 @@ library(DT) library(plotly) library(lsr) library(knitr) +``` +```{r setup, include=FALSE} - - +# Global options: hide code, warnings and messages in the final report. +knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE) ``` -1. Data Import and Exploration -```{r} -# Import the design file (CSV) +## 1. Data Import and Interactive Overview + +```{r data_import, echo=FALSE} +# Import the design file (CSV) using the path specified in the input parameters. annotations <- read.csv(design_file, sep = ",", stringsAsFactors = FALSE) -# Convert specified categorical variables to factors. -annotations <- annotations %>% - mutate(across(all_of(categorical_vars), as.factor)) +# Display an interactive table to review all variables in the dataset. +DT::datatable(annotations, + options = list(pageLength = 10, autoWidth = TRUE), + caption = "Interactive Data Table: Review the design file") -# Overview of data structure and summary. -glimpse(annotations) -summary(annotations) -# Check missing values per column. -missing_values <- colSums(is.na(annotations)) -print(missing_values) +``` -``` -2. Variable Separation and Conversion +### Manual Data Classification and Modification +## 2. Manual Data Classification and Modification -```{r} -# Variables numériques d'origine (pour certaines analyses) -num_data <- annotations %>% select(where(is.numeric)) +```{r data_classification, echo=TRUE} +# After reviewing the dataset via the interactive table, you can decide which variables +# should be treated as categorical, which as quantitative, and which ones to display +# in the advanced pairs plot. -# Variables catégorielles d'origine (caractère ou facteur) -cat_data <- annotations %>% select(where(~ is.character(.) | is.factor(.))) -cat("Variables numériques détectées : ", paste(colnames(num_data), collapse = ", "), "\n") -cat("Variables catégorielles détectées : ", paste(colnames(cat_data), collapse = ", "), "\n") +# Print the default classification lists defined in the input parameters: +cat("Default Categorical Variables: ", paste(categorical_vars, collapse = ", "), "\n") +cat("Default Quantitative Variables: ", paste(quantitative_vars, collapse = ", "), "\n") +cat("Default Variables for Advanced Pairs Plot: ", paste(display_vars, collapse = ", "), "\n") +# If needed, manually modify the classification lists below: +# (For example, if you decide that a variable should be reclassified, update the lists here.) +# categorical_vars <- c("sample", "condition", "animal", "experiment", "extraction") +# quantitative_vars <- c("volume", "quantity") +# display_vars <- c("condition", "animal", "experiment", "extraction") ``` + + + + + 2.1 Automated Conversion for Correlation Analysis ```{r}