Skip to content

Whitespace padding in print.apa_results_table() #589

@mariusbarth

Description

@mariusbarth

Hi @crsh,

results tables from repeated-measures ANOVA may contain df and df.residual columns where sometimes the values are whole numbers, sometimes they have two digits after the decimal point, e.g.:

A data.frame with 7 labelled columns:

                                                        term estimate     conf.int statistic   df df.residual p.value
1                                                  Treatment     .312 [.000, .581]      4.63    2          10    .038
2                                                     Gender     .111 [.000, .437]      2.56    1          10    .141
3                                                      Phase     .264 [.003, .479]     20.87 1.60       15.99  < .001
4                                                       Hour     .185 [.000, .319]     17.01 1.84       18.41  < .001
5                                 Treatment $\\times$ Gender     .218 [.000, .501]      2.86    2          10    .104
6                                  Treatment $\\times$ Phase     .144 [.000, .292]      4.90 3.20       15.99    .012
7                                     Gender $\\times$ Phase     .004 [.000, .000]      0.21 1.60       15.99    .766
8                                   Treatment $\\times$ Hour     .002 [.000, .000]      0.09 3.68       18.41    .979
9                                      Gender $\\times$ Hour     .005 [.000, .000]      0.41 1.84       18.41    .653
10                                      Phase $\\times$ Hour     .023 [.000, .000]      1.15 3.60       35.96    .346
11                Treatment $\\times$ Gender $\\times$ Phase     .021 [.000, .000]      0.64 3.20       15.99    .612
12                 Treatment $\\times$ Gender $\\times$ Hour     .016 [.000, .000]      0.62 3.68       18.41    .641
13                  Treatment $\\times$ Phase $\\times$ Hour     .013 [.000, .000]      0.33 7.19       35.96    .940
14                     Gender $\\times$ Phase $\\times$ Hour     .014 [.000, .000]      0.69 3.60       35.96    .589
15 Treatment $\\times$ Gender $\\times$ Phase $\\times$ Hour     .029 [.000, .000]      0.74 7.19       35.96    .646

term     : Effect 
estimate : $\\hat{\\eta}^2_G$ 
conf.int : 90\\% CI 
statistic: $F$ 
df       : $\\mathit{df}^{\\mathrm{GG}}$ 
... (2 more labels)
attr(,"class")
[1] "apa_results" "list" 

For better legibility, I wondered whether we should pad the whole numbers with whitespace in print.apa_results_table(), such as:

$table
A data.frame with 7 labelled columns:

                                                        term estimate     conf.int statistic   df df.residual p.value
1                                                  Treatment     .312 [.000, .581]      4.63 2          10       .038
2                                                     Gender     .111 [.000, .437]      2.56 1          10       .141
3                                                      Phase     .264 [.003, .479]     20.87 1.60       15.99  < .001
4                                                       Hour     .185 [.000, .319]     17.01 1.84       18.41  < .001
5                                 Treatment $\\times$ Gender     .218 [.000, .501]      2.86 2          10       .104
6                                  Treatment $\\times$ Phase     .144 [.000, .292]      4.90 3.20       15.99    .012
7                                     Gender $\\times$ Phase     .004 [.000, .000]      0.21 1.60       15.99    .766
8                                   Treatment $\\times$ Hour     .002 [.000, .000]      0.09 3.68       18.41    .979
9                                      Gender $\\times$ Hour     .005 [.000, .000]      0.41 1.84       18.41    .653
10                                      Phase $\\times$ Hour     .023 [.000, .000]      1.15 3.60       35.96    .346
11                Treatment $\\times$ Gender $\\times$ Phase     .021 [.000, .000]      0.64 3.20       15.99    .612
12                 Treatment $\\times$ Gender $\\times$ Hour     .016 [.000, .000]      0.62 3.68       18.41    .641
13                  Treatment $\\times$ Phase $\\times$ Hour     .013 [.000, .000]      0.33 7.19       35.96    .940
14                     Gender $\\times$ Phase $\\times$ Hour     .014 [.000, .000]      0.69 3.60       35.96    .589
15 Treatment $\\times$ Gender $\\times$ Phase $\\times$ Hour     .029 [.000, .000]      0.74 7.19       35.96    .646

term     : Effect 
estimate : $\\hat{\\eta}^2_G$ 
conf.int : 90\\% CI 
statistic: $F$ 
df       : $\\mathit{df}^{\\mathrm{GG}}$ 
... (2 more labels)
attr(,"class")
[1] "apa_results" "list"  

What do you think? I would be happy to provide a PR for this one.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions