R for
Authoring!!

PSP Session #25…
…shiny reports

Problem-Solving Panel
(May 14, 2024)

  • Recap session #24       ↔︎️
  • Focal issue:
    • Dashboard reports 📔
    • Shiny
  • Shared problem-solving

Recap of Session #24:

APA manuscripts 📜📜

  • papaja
    • framework 🏗
    • tables 🧮
    • figures 📊
    • in-line stats 🖥
    • citations 🚔
---
title             : "Neuroticism's association with 
                      other factors: The revenge"
shorttitle        : "Everyone's Neurotic"

author: 
  - name          : "Diego"
    affiliation   : "1"
    corresponding : yes    
    address       : "Postal address"
    email         : "my@email.com"
    role: 
      - "Conceptualization"
      - "Writing - Original Draft Preparation"
      - "Writing - Review & Editing"
  - name          : "Catrina"
    affiliation   : "1,2"
    role:
      - "Writing - Review & Editing"
      - "Supervision"
  - name          : "Ian"
    affiliation   : "3"
    
affiliation:
  - id            : "1"
    institution   : "Millie University"
  - id            : "2"
    institution   : "Krusty's Hamburger School"
  - id            : "3"
    institution   : "Smooth Hacker University"

authornote: |
  Enter author note here.

abstract: |
  One or two sentences 
  
keywords          : "keywords"
wordcount         : "X"

bibliography      : "r-references.bib"

floatsintext      : no
linenumbers       : yes
draft             : no
mask              : no

figurelist        : no
tablelist         : no
footnotelist      : no

csl               : "apa (2).csl"
documentclass     : "apa7"
classoption       : "man"
output            : papaja::apa6_pdf
---
1
Grab your desired citation style from Zotero
2
This field is necessary to render consistent with the most recent APA publication manual (don’t worry about the output command on line #55)
r <- corx::corx(bfi.recoded[,c(29:33)],
                triangle = "lower",
                stars = c(0.05, 0.01, 0.001),
                describe = c(`$M$`=mean, 
                             `$SD$`=sd))

papaja::apa_table(r$apa,
                  escape=FALSE,                    
                  note="Neuroticism ROCKS!!!",
                  caption = "Bunch of correlations 
                  among personality traits")       
1
Will produce object$apa matrix (line #7) that works well with APA tables
library(ggplot2)

plot <- ggplot(bfi.recoded, 
               aes(x=c, y=n, color=gender)) +
                        geom_point() + 
                        geom_jitter() + 
                        papaja::theme_apa() + 
                        geom_smooth(method=lm)
  
plot
data(iris)
multreg <- lm(Sepal.Length ~ Petal.Width+
                Petal.Length, iris)

reportreg <- papaja::apa_print(multreg)

## The model fit was `r reportreg$estimate$modelfit`
1
reportreg list will have multiple options for you to pull into body of report

The model fit was \(R^2 = .77\), 90% CI \([0.70, 0.81]\), \(R^2_{adj} = .76\), \(\mathrm{AIC} = 158.05\), \(\mathrm{BIC} = 170.09\)

@incollection{eysenck1983psychophysiology,
  title={Psychophysiology and personality: 
              Extraversion, neuroticism 
              and psychoticism},
  author={Eysenck, Hans J},
  booktitle={Individual differences and 
              psychopathology},
  pages={13--30},
  year={1983},
  publisher={Elsevier}
}

## A neat paper is @eysenck1983psychophysiology
1
@ precedes the citation tag located on line #1

A neat paper is Eysenck (1983)

Today:

Reports from Shiny dashboards

Session Info (May 14, 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     

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

Eysenck, Hans J. 1983. “Psychophysiology and Personality: Extraversion, Neuroticism and Psychoticism.” In Individual Differences and Psychopathology, 13–30. Elsevier.