View source: R/format_flextable.R
format_flextable | R Documentation |
This function takes a flextable object, and applies APA 7th
standard style formatting to it.
The initial idea for this function stems from
Remi Theriault's Blog.
Reference on what APA style for tables constitutes can be obtained on the
apastyle.apa.org website.
See also the very neat packages flextable
and read_docx
,
by David Gohel and Colleagues, which enables us to get our publication ready tables directly
into MS Word.
format_flextable( ft, font = "Times New Roman", fontsize = 12, table_caption = c("Table x", "Some Description of the Table"), table_note = NA, italize_stats = TRUE, linespacing = 1.25, ... )
ft |
A flextable object (prefered) or data.frame, to be formatted in accordance with APA. Required! |
font |
Default is "Times New Roman", can be changed to your needs (e.g., "Arial") |
fontsize |
Default is 12, bigger font size is not recommended. |
table_caption |
Takes a character vector. Note: when provided NA no caption will be placed! Recommend are the following elements
|
table_note |
Takes a character vector. Will automatically prepend Note if not present. Default is NA (no table note). e.g., is c("Explanation of Abbreviations", "* p < .05. ** p < .01. *** p < .001"). Please note that you will need to manually set the formatting (i.e., setting italic for p values). |
italize_stats |
Boolean, default is TRUE. Searches the header for common statistic symbols (e.g. p N SD M) and sets font to italic |
linespacing |
Points of Linespacing defaults to 1.25, APA would be 1.5 or 2 |
... |
(Optional) Additional Parameters, not utiliezd in this function, enables passing from passing of previous functions |
An APA style formatted flextable object.
Bjoern Buedenbender / Remi Theriault
flextable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.