Blog

We provide practical tutorials on data mining, visualization and statistics for decision making.

Version: Français

Requirements: dplyr v>=1.0.0 library(dplyr) # Data preparation df <- as_tibble(iris) df ## # A tibble: 150 x 5 ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## <dbl> <dbl> <dbl> <dbl> <fct> ## 1 5.1 3.5 1.4 0.2 setosa ## 2 4.9 3 1.4 0.2 setosa...

dplyr: How to Select a Character Vector of Variable Names

Requirements: dplyr v>=1.0.0 library(dplyr) # Data preparation df <- as_tibble(iris) df ## # A tibble: 150 x 5 ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## <dbl> <dbl> <dbl> <dbl> <fct> ## 1 5.1 3.5 1.4 0.2 setosa ## 2 4.9 3 1.4 0.2 setosa...

This article describes how to compute summary statistics, such as mean, sd, quantiles, across multiple numeric columns. Key R functions and packages The dplyr package is required. We’ll use the function across() to make computation across multiple columns. Usage: across(.cols = everything(),...

dplyr: How to Compute Summary Statistics Across Multiple Columns

This article describes how to compute summary statistics, such as mean, sd, quantiles, across multiple numeric columns. Key R functions and packages The dplyr package is required. We’ll use the function across() to make computation across multiple columns. Usage: across(.cols = everything(),...

You will learn how to create beautiful plots in R and add summary summary statistics table such as sample size (n), median, mean and IQR onto the plot. We will also describes how to create multipanel graphics combined with the summary table. Examples of...

How to Create a Beautiful Plots in R with Summary Statistics Labels

You will learn how to create beautiful plots in R and add summary summary statistics table such as sample size (n), median, mean and IQR onto the plot. We will also describes how to create multipanel graphics combined with the summary table. Examples of...

R codes are provided for creating a nice box and whisker plot in R with summary table under the plot. # Load required R packages library(ggpubr) # Data preparation df <- ToothGrowth head(df) ## len supp dose ## 1 4.2 VC 0.5 ## 2...

How to Create a Nice Box and Whisker Plot in R

R codes are provided for creating a nice box and whisker plot in R with summary table under the plot. # Load required R packages library(ggpubr) # Data preparation df <- ToothGrowth head(df) ## len supp dose ## 1 4.2 VC 0.5 ## 2...

# Load required R packages suppressPackageStartupMessages(library(ggpubr)) suppressPackageStartupMessages(library(dplyr)) # Example of data from statistical tests stat.test <- tibble::tribble( ~supp, ~group1, ~group2, ~p.adj, ~p.signif, "VC", "0.5", "1", 3.4e-06, "****", "VC", "0.5", "2", 2.8e-07, "****", "VC", "1", "2", 0.00026, "****", "OJ", "0.5", "1", 0.00026, "****", "OJ", "0.5",...

How to Draw a Textual Table with GGPLOT and Color Cells Conditionally

# Load required R packages suppressPackageStartupMessages(library(ggpubr)) suppressPackageStartupMessages(library(dplyr)) # Example of data from statistical tests stat.test <- tibble::tribble( ~supp, ~group1, ~group2, ~p.adj, ~p.signif, "VC", "0.5", "1", 3.4e-06, "****", "VC", "0.5", "2", 2.8e-07, "****", "VC", "1", "2", 0.00026, "****", "OJ", "0.5", "1", 0.00026, "****", "OJ", "0.5",...

This article how to visualize distribution in R using density ridgeline. The density ridgeline plot is an alternative to the standard geom_density() function that can be useful for visualizing changes in distributions, of a continuous variable, over time or...

Elegant Visualization of Density Distribution in R Using Ridgeline

This article how to visualize distribution in R using density ridgeline. The density ridgeline plot is an alternative to the standard geom_density() function that can be useful for visualizing changes in distributions, of a continuous variable, over time or...

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) Data preparation We’ll use the anxiety dataset , which contains the anxiety score, measured at three time points (t1, t2 and t3), of three groups of individuals practicing physical exercises at different...

How to Perform Multiple Paired T-tests in R

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) Data preparation We’ll use the anxiety dataset , which contains the anxiety score, measured at three time points (t1, t2 and t3), of three groups of individuals practicing physical exercises at different...

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) Data preparation We’ll use the self-esteem score dataset measured over three time points. The data is available in the datarium package. # Wide format data("selfesteem", package = "datarium") head(selfesteem, 3) ## # A tibble: 3...

How to Perform Paired Pairwise T-tests in R

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) Data preparation We’ll use the self-esteem score dataset measured over three time points. The data is available in the datarium package. # Wide format data("selfesteem", package = "datarium") head(selfesteem, 3) ## # A tibble: 3...

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) # Prepare the data and inspect a random sample of the data mydata <- as_tibble(iris) mydata %>% sample_n(6) ## # A tibble: 6 x 5 ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## <dbl> <dbl> <dbl>...

How to Perform T-test for Multiple Variables in R: Pairwise Group Comparisons

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) # Prepare the data and inspect a random sample of the data mydata <- as_tibble(iris) mydata %>% sample_n(6) ## # A tibble: 6 x 5 ## Sepal.Length Sepal.Width Petal.Length Petal.Width Species ## <dbl> <dbl> <dbl>...

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) # Prepare the data and inspect a random sample of the data data("PlantGrowth") set.seed(1234) PlantGrowth %>% sample_n_by(group, size = 1) ## # A tibble: 3 x 2 ## weight group ## <dbl> <fct> ## 1...

How to Perform T-test for Multiple Groups in R

Prerequisites # Load required R packages library(tidyverse) library(rstatix) library(ggpubr) # Prepare the data and inspect a random sample of the data data("PlantGrowth") set.seed(1234) PlantGrowth %>% sample_n_by(group, size = 1) ## # A tibble: 3 x 2 ## weight group ## <dbl> <fct> ## 1...