R for
Authoring!!

PSP Session #24…
…one more time APA

Problem-Solving Panel
(May 10, 2024)

  • Recap session #23       ↔︎️
  • Focal issue(s):
  • Shared problem-solving

Recap of Session #23:

APA inline reporting ✍️

Intended for “cutting and pasting” into a processor such as Word - not ideal for inline reporting for reproducible research.

Supports:

  • t-test
  • ANOVA
  • \(\chi^2\)
  • correlation

library(psych)
library(apa)
data(bfi)

bfi$a<- rowMeans(bfi[1:5], 
                 na.rm=TRUE)
bfi$gender <- as.factor(as.character
                        (bfi$gender))

analysis <- t.test(a ~ gender, 
          data = bfi, var.equal=TRUE)

## Trying the `apa` t-test wrapper 
## here: `r apa(analysis)` 

Wrapper is simply, apa().

Last week mistake was trying to use the t_apa() function (which produces similar output as schoRsch).


Trying the apa t-test wrapper here: t(2798) = -7.13, p < .001, d = -0.27

library(psych)
library(apastats)
data(bfi)

bfi$a<- rowMeans(bfi[1:5], 
                 na.rm=TRUE)
bfi$gender <- as.factor(as.character
                        (bfi$gender))

analysis <- t.test(a ~ gender, 
          data = bfi, var.equal=TRUE)

## Trying the `apastats` t-test wrapper 
## here: `r describe.ttest(analysis)` 

Trying the apastats t-test wrapper here: t(2798.0) = -7.13, p < .001

library(psych)
library(papaja)
data(bfi)

bfi$a<- rowMeans(bfi[1:5], 
                 na.rm=TRUE)
bfi$gender <- as.factor(as.character
                        (bfi$gender))

analysis <- t.test(a ~ gender, 
          data = bfi, var.equal=TRUE)

papastat <- apa_print(analysis)

## Trying the `papaja` t-test  
## wrapper here: `r papastat$full_result` 

Trying the papaja t-test wrapper here: \(\Delta M = -0.21\), 95% CI \([-0.27, -0.15]\), \(t(2798) = -7.13\), \(p < .001\)

Today:

APA IV: Together at last 🤵👰

Manuscript:

  • papaja
    • framework 🏗
    • tables 🧮
    • figures 📊
    • in-line stats 🖥
    • citations 🚔

Session Info (May 10, 2024) Rendering:

R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] papaja_0.1.2     tinylabels_0.2.3 apastats_0.4     apa_0.3.4       
[5] psych_2.4.1     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10       lubridate_1.9.3   lattice_0.20-45   prettyunits_1.2.0
 [5] ps_1.7.5          assertthat_0.2.1  digest_0.6.31     utf8_1.2.4       
 [9] mime_0.12         R6_2.5.1          evaluate_0.23     pillar_1.9.0     
[13] rlang_1.1.3       curl_5.2.1        fontawesome_0.5.2 rstudioapi_0.15.0
[17] miniUI_0.1.1.1    callr_3.7.3       urlchecker_1.0.1  effectsize_0.8.3 
[21] rmarkdown_2.26    devtools_2.4.5    stringr_1.5.1     htmlwidgets_1.6.4
[25] shiny_1.7.4       compiler_4.2.2    httpuv_1.6.9      xfun_0.42        
[29] parameters_0.20.3 pkgconfig_2.0.3   mnormt_2.1.1      pkgbuild_1.4.0   
[33] htmltools_0.5.7   insight_0.19.1    tidyselect_1.2.1  tibble_3.2.1     
[37] emo_0.0.0.9000    fansi_1.0.6       crayon_1.5.2      dplyr_1.1.4      
[41] withr_3.0.0       later_1.3.1       grid_4.2.2        nlme_3.1-160     
[45] jsonlite_1.8.8    xtable_1.8-4      lifecycle_1.0.4   bayestestR_0.13.1
[49] magrittr_2.0.3    datawizard_0.7.1  cli_3.6.0         stringi_1.7.12   
[53] cachem_1.0.8      fs_1.6.2          promises_1.2.0.1  remotes_2.4.2    
[57] ellipsis_0.3.2    generics_0.1.3    vctrs_0.6.5       tools_4.2.2      
[61] glue_1.6.2        purrr_1.0.1       processx_3.8.1    pkgload_1.3.2    
[65] parallel_4.2.2    fastmap_1.1.1     yaml_2.3.8        timechange_0.3.0 
[69] MBESS_4.9.2       sessioninfo_1.2.2 memoise_2.0.1     knitr_1.45       
[73] profvis_0.3.7     usethis_2.2.3