19 Jun 2018 - Written by Dominique Makowski

Go to main menu.

Copy/paste t-tests Directly to Manuscripts

One of the most time-consuming part of data analysis in psychology is the copy-pasting of specific values of some R output to a manuscript or a report. This task is frustrating, prone to errors, and increases the variability of statistical reporting. This is an important issue, as standardizing practices of what and how to report might be a key to overcome the reproducibility crisis of psychology. The psycho package was designed specifically to do this job. At first, for complex Bayesian mixed models, but the package is now compatible with basic methods, such as t-tests.

Do a t-test

# Load packages

# devtools::install_github("neuropsychology/psycho.R")  # Install the latest psycho version

df <- psycho::affective  # Load the data

results <- t.test(df$Age ~ df$Sex)  # Perform a simple t-test

APA formatted output

You simply run the analyze() function on the t-test object.

The Welch Two Sample t-test suggests that the difference of df$Age by df$Sex (mean in group F = 26.78, mean in group M = 27.45, difference = -0.67) is not significant (t(360.68) = -0.86, 95% CI [-2.21, 0.87], p > .1).


It works for all kinds of different t-tests versions.

t.test(df$Adjusting ~ df$Sex,
       conf.level = .90) %>% 
The  Two Sample t-test suggests that the difference of df$Adjusting by df$Sex (mean in group F = 3.72, mean in group M = 4.13, difference = -0.41) is significant (t(1249) = -4.13, 90% CI [-0.58, -0.25], p < .001).
       conf.level = .90) %>% 
The One Sample t-test suggests that the difference between df$Adjusting (mean = 3.80) and mu = 0 is significant (t(1250) = 93.93, 90% CI [3.74, 3.87], p < .001).

Dataframe of Values

It is also possible to have all the values stored in a dataframe by running a summary on the analyzed object.


t.test(df$Adjusting ~ df$Sex) %>% 
  psycho::analyze() %>% 
effect statistic df p CI_lower CI_higher
-0.4149661 -4.067008 377.8364 5.8e-05 -0.6155884 -0.2143439


Of course, these reporting standards should change, depending on new expert recommandations or official guidelines. The goal of this package is to flexibly adapt to new changes and accompany the evolution of best practices. Therefore, if you have any advices, opinions or ideas, we encourage you to let us know by opening an issue or, even better, to try to implement changes yourself by contributing to the code.


This package helped you? Don’t forget to cite the various packages you used :)

You can cite psycho as follows:

Previous blogposts