crsh / papaja

papaja (Preparing APA Journal Articles) is an R package that provides document formats to produce complete APA manuscripts from RMarkdown-files (PDF and Word documents) and helper functions that facilitate reporting statistics, tables, and plots.
https://frederikaust.com/papaja_man/
Other
642 stars 132 forks source link

Enable horizontal alignment by decimal point in apa_table.latex() #51

Open crsh opened 8 years ago

crsh commented 8 years ago

Unless the align parameter is specified in a call to apa_table.latex(), it seems to me that aligning columns with numbers by decimal point is a sensible default. The siunitx package seems like a good option to achieve this (see example here).

TheDom42 commented 5 years ago

Hi there, has this been somehow implemented or is this under development? If tried generating a an apa_table from an afex_output and I noticed that the F-values were not correctly aligned on the decimal point. I manually edited the generated LaTeX-file to use siunitx, and it worked for the alignment. However, using an S-column-type from siunitx leads to the addition of leading zeros for the p-values (even if they are not actually typed out in the table).

EDIT: I actually just found a solution to the leading zero problem. Adding \sisetup{add-integer-zero=false} keeps the zeros from appearing in p-values. Maybe a combination of the code below and this information can help you develop an option for papaja?

Those are the two options and their results Option 1

l
S[table-format=2.2]
S[table-format=1.2]
S[table-format=2.2]
S[table-format=1.2]
c
S[table-format=0.3]

grafik

Option 2

l
S[table-format=2.2]
S[table-format=1.2]
S[table-format=2.2]
S[table-format=1.2]
S[table-format=<.3]
S[table-format=0.3]

grafik

TheDom42 commented 5 years ago

On a sidenote: the afex-tables produced by apa_table completely ignore the table options passed to afex (such as reporting of the uncorrected dfs or use of pes instead of ges). It would be good to correct this as otherwise wrong results might be displayed (e.g. when Mauchly is not significant, I want uncorrected dfs). This is also true for reporting the results in the text, as full_result also ignores these options. Also: in a regular apa_table call to an afex object, the effect sizes in the last column of the table (see also above) are not corrected to gt1 = F (they are displayed with a leading zero).

crsh commented 5 years ago

Hi Dominik,

thanks for the documentation of your attempts. I have not had time to add this feature and I'm afraid it will be a little while until I get around to it. But it's stilled planned for a future release. You are, however, welcome to submit a pull request, if you like.

Regarding the second issue: Could you open a new issue for this and add a reproducible example?