For quite some time I struggled to copy and paste the results from my t-tests and ANOVAs to my manuscripts. I finally decided to write a short script that puts the data in a structure I would like to present it in an article.
article.ttest(obj=NULL, unit=”ms”)
Produces article-ready output for a one- or two-sample t-test
Receives the result of the t.test()-function as input, one or two-sample
obj: a t.test object (list of 9)
unit: the measurement unit, standard is ms
> # One-sample / Paired samples t-test > article.ttest(tt) [1] "M = -9 ms; t(126) = -0.69, p = .493, 95% CI [-35 ms, 17 ms]" > # Independent two-sample t-test > apa.ttest(tt) [1] "693 ms vs 702 ms; t(249.53) = -0.47, p = .639, 95% CI [-48 ms, 29 ms]"
article.ttest_full(obj=NULL, dz=NULL, BF=NULL, unit=”ms”)
Produces article-ready output for a one- or two-sample t-test, Cohens D, and bayesian t-test
Receives the result of the t.test()-function, the cohensD()-function and the ttestBF(function)
obj: a t.test object (list of 9)
unit: the measurement unit, standard is ms
> t.test, Cohens D, Bayesian ttest > apa.ttest_full(tt,d,BF) [1] "693 ms vs 702 ms; t(249.53) = -0.47, p = .639, dz = 0.06, 95% HPD [-34 ms, 16 ms], BF10 = 0.12"
article.ezANOVA(obj=NULL)
Produces article-ready output for an ezANOVA, in text form.
At the moment, p-values and DFs are not GG-corrected!
Receives the result of the ezANOVA()-function (return_aov = FALSE)
obj: a t.test object (list of 9)
unit: the measurement unit, standard is ms
> # ezANOVA > article.ezANOVA(aov) [1] "The main effect distractor_type was not significant: F(1, 181) = 3.12, p = .079; The main effect target_pos was significant: F(1, 181) = 10.71, p = .001; The interaction distractor_type X target_pos was significant: F(1, 181) = 5.58, p = .019"
Include functions
You can include the functions by adding these lines to the top of your script. I suggest you use the online version to automatically receive updates.
if(!exists("article.ttest", mode="function")) source("https://www.mariansauter.de/files/R/r_functions_article.R") if(!exists("article.ttest_full", mode="function")) source("https://www.mariansauter.de/files/R/r_functions_article.R") if(!exists("article.ezANOVA", mode="function")) source("https://www.mariansauter.de/files/R/r_functions_article.R")
If you have any questions, suggestions or found similar endeavors online, please let me know! For issues with the script, please contact me directly or refer to the github page.
Leave a Reply