0

I want to use to following exampe to do t-tests with multiple variables - The code is used from https://www.datanovia.com/en/blog/how-to-perform-multiple-t-test-in-r-for-different-variables/:

options(scipen = 99)

# Load required R packages
library(tidyverse)
library(rstatix)
library(ggpubr)

# Prepare the data and inspect a random sample of the data
mydata <- iris %>%
  filter(Species != "setosa") %>%
  as_tibble()
mydata %>% sample_n(6)

# Transform the data into long format
# Put all variables in the same column except `Species`, the grouping variable
mydata.long <- mydata %>%
  pivot_longer(-Species, names_to = "variables", values_to = "value")
mydata.long %>% sample_n(6)

stat.test <- mydata.long %>%
  group_by(variables) %>%
  t_test(value ~ Species) %>%
  adjust_pvalue(method = "BH") %>%
  add_significance()
stat.test

This tutorial uses the t_test function of the rstatix package. It works great, but is there a way to disable the scientific notation of the p-values? I want to output p-values like 0.000445 instead of 4.45e-4.

Unfortunetely the use of

options(scipen = 99)

did not change anything.

Thank you!

EDIT: The solution can be found in the comments - it is necessary to call stat.test this way:

as.data.frame(stat.test)

Thank rawr for his comment!

MDStat
  • 355
  • 2
  • 17

0 Answers0