Function that allows the creation of a full APA-style table with all citations and informations
on the R-packages utilized.
The table will contain the following columns (Packagename | Version | Maintainer | Citation)
The function writes two files (in a given directory)
The APA style table as .docx (default, or as .csv if desired)
A .bib file for the correct citations.
The citation column needs to be filled manually by importing the .bib
file in the reference manager
of your choice (e.g., mendeley, endnote, ...) and pasting the citation in the
respective column
Note I highly recommend to cite the main packages used for your
analysis in the methods / analyses section of your manuscript. However to
give full credit to all packages / package authors, you can create this table
and reference it in the appendix. This also increases reproduciblity, as every
dependency to run your script becomes transparent.
Usage
Rcitation_appendix(
outdirectory = "Appendix",
filename = "Appendix - R Packages.docx",
overwrite = FALSE,
table_caption = c("Table A1", "All R-Packages Utilized and Dependencies"),
...
)
Arguments
- outdirectory
(Optional) Character vector for the output directory (for the two files, .bib and .csv). Default is "Appendix/" in the current working directory (see with getwd())
- filename
(Optional) Character vector. Custom name for the formatted APA-style table, that should end with .docx. A docx file will be provided. If NA, a csv file of the table will be saved.
- overwrite
(Optional) Boolean, default is FALSE. When overwrite is FALSE and the files already exists, a serialized version of the filename will be created (i.e., appending _001, or _002). Utilizes
serialNext
- table_caption
Takes a character vector. For reference see see
format_flextable
.
Recommend are the following elementsTable + number (e.g., "Table 1")
The description, use APA capital case (e.g., "Sociodemographic Characteristics of the Total Sample")
- ...
(Optional), Additional arguments that can be passed to
format_flextable
(e.g., fontsize, font ...)
Value
Creates (respective returns, depending on the arguments specified) the following:
Creates the directory Appendix/ (if no other outcomedirectory is specified)
In the "Appendix/" dir a .bib file is created for the citation
Either creates an APA 7th style table in a .docx or a plain .csv table
Additionally returns the
flextable::flextable
object with the APA 7th style table.