If you do not want to use the tenzing app, you can use the package from R to achieve the same outputs.
Setup
First, you have to install the package.
# install.packages("devtools")
devtools::install_github("marton-balazs-kovacs/tenzing")
Second you have to load the package.
Create your contributors table
The contributors table template is built in the package, as well as uploaded to the net. If you choose to fill out the template with your CRediT information locally, you can write your contributors table as an xlsx file to your working directory from the package with the following code:
# install.packages("writexl")
writexl::write_xlsx(contributors_table_template, "my_contributors_table.xlsx")
To get more information on the contributors table template use the
?tenzing::contributors_table_template
command.
Note: This produces the same result as downloading the contributors table template from the link provided before.
Note: The contributors table template was changed since the first release, as some of the CRediT roles were not named properly in the template columns.
Load your contributors table
You can load the contributors table into R with the
tenzing::read_contributors_table
function. This function
accepts files with csv, tsv, xlsx extensions, and the share URL of the
Google spreadhseet. As an example we will use the built in contributors
table template.
file_path <- system.file("extdata", "contributors_table_example.csv", package = "tenzing", mustWork = TRUE)
my_contributors_table <- read_contributors_table(contributors_table_path = file_path)
#> Rows: 3 Columns: 26
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (9): Firstname, Middle name, Surname, Affiliation 1, Affiliation 2, Aff...
#> dbl (1): Order in publication
#> lgl (16): Conceptualization, Data curation, Formal analysis, Funding acquisi...
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
If the read contributors table still contains empty rows you can
clean it with the clean_contributors_table
function.
my_contributors_table <- clean_contributors_table(my_contributors_table)
Validate your contributors table
Before generating outputs, you must check whether your
contributors_table
is well-formatted. In
tenzing, validation is handled using two R6
classes:
-
ColumnValidator
: Ensures required columns exist. -
Validator
: Runs logical and consistency checks on the data.
Both work based on YAML configuration files,
allowing for flexible, customizable validation pipelines. For a detailed
explanation of validation rules and configurations, please refer to the
Validation Vignette
.
tenzing supports multiple output types, each
requiring a properly formatted contributors_table.
You can
use the ValidateOutput
R6 class to check your table
against a specific configuration for each output.
For example, if you want to generate a title page for your manuscript, you should first validate your table to ensure it meets the required structure.
1. Load the Title Page Validation Configuration
config_path <- system.file("config/title_validation.yaml", package = "tenzing")
2. Initialize a Validation Instance
validate_output_instance <- ValidateOutput$new(config_path = config_path)
3. Run the Validation Checks
validate_results <- validate_output_instance$run_validations(contributors_table = my_contributors_table)
4. Review Validation Results
Each check returns one of three statuses:
- success – The check passed.
- warning – The table has issues that may affect output quality.
- error – The table is incorrectly formatted and must be fixed before generating output.
You can check the status of each validation:
purrr::map(validate_results, "type")
#> $minimal
#> [1] "success"
#>
#> $affiliation
#> [1] "success"
#>
#> $title
#> [1] "success"
#>
#> $check_missing_order
#> [1] "success"
#>
#> $check_duplicate_order
#> [1] "success"
#>
#> $check_missing_surname
#> [1] "success"
#>
#> $check_missing_firstname
#> [1] "success"
#>
#> $check_duplicate_initials
#> [1] "success"
#>
#> $check_missing_corresponding
#> [1] "success"
#>
#> $check_missing_email
#> [1] "success"
#>
#> $check_duplicate_names
#> [1] "success"
#>
#> $check_affiliation
#> [1] "success"
#>
#> $check_affiliation_consistency
#> [1] "success"
And review the detailed messages for failed checks:
purrr::map(validate_results, "message")
#> $minimal
#> All column requirements satisfied.
#>
#> $affiliation
#> All column requirements satisfied.
#>
#> $title
#> All column requirements satisfied.
#>
#> $check_missing_order
#> [1] "There are no missing values in the order of publication."
#>
#> $check_duplicate_order
#> [1] "There are no duplicated order numbers in the contributors_table."
#>
#> $check_missing_surname
#> [1] "There are no missing surnames."
#>
#> $check_missing_firstname
#> [1] "There are no missing firstnames."
#>
#> $check_duplicate_initials
#> [1] "There are no duplicate initials in the contributors_table."
#>
#> $check_missing_corresponding
#> [1] "There is at least one author indicated as corresponding author."
#>
#> $check_missing_email
#> [1] "There are email addresses provided for all corresponding authors."
#>
#> $check_duplicate_names
#> [1] "There are no duplicate names in the contributors_table."
#>
#> $check_affiliation
#> [1] "There are no missing affiliations in the contributors_table."
#>
#> $check_affiliation_consistency
#> [1] "Affiliation column names are used consistently."
Generate output
If your contributors table is validated you can move on to output generation. There are six different types of outputs that you can create with the tenzing app.
For the human readable report and the contributors’ affiliation page
the output text will be rmarkdown formatted by default. However, by
setting the text_format
argument to "html"
the
output can be HTML formatted as well, or by setting the argument to
"raw"
, the output string will not be formatted at all.
create a human readable report of the contributions according to the CRediT taxonomy
For this section it is possible to use initials by setting the
initials
argument TRUE
. Also, if the
order_by
argument is set to contributor
the
function will list the contributions after the name of each researcher,
instead of listing the appropriate names after each CRediT role.
print_credit_roles(contributors_table = my_contributors_table, initials = TRUE, order_by = "contributor")
#> **J.M.S.:** Data curation, Funding acquisition, and Project administration.
#> **L.W.L.:** Data curation, Project administration, Resources, Writing - original draft, and Writing - review & editing.
#> **M.K.:** Conceptualization, Funding acquisition, Methodology, and Supervision.
Create the contributors’ affiliation page
print_title_page(contributors_table = my_contributors_table)
#> John M. Smith^1,2*†^, Marton Kovacs^1,3,4*^, Lex W. Luthor^2,5^
#>
#> ^1^Institute of Psychology, ELTE Eotvos Lorand University, Budapest, Hungary, Doctoral School of Psychology, ^2^LexCorp, Smallville, Kansas, US, ^3^Department of Psychology, ^4^Institute for Interstellar Relations, Oxbridge University, UK, ^5^Metropolis University
#>
#> *John M. Smith and Marton Kovacs are shared first authors. ^†^ Correspondence should be addressed to John M. Smith; E-mail: some@email.com.
Create a JATS formatted XML document containing the contributors information
print_xml(contributors_table = my_contributors_table)
#> {xml_document}
#> <contrib-group>
#> [1] <contrib>\n <name surname="Kovacs" given-names="Marton"/>\n <role vocab ...
#> [2] <contrib>\n <name surname="Luthor" given-names="Lex W."/>\n <role vocab ...
#> [3] <contrib>\n <name surname="Smith" given-names="John M."/>\n <role vocab ...
Create a YAML document containing the contributors informtation
This output can be incorporated into manuscript created with the
papaja
package.
print_yaml(contributors_table = my_contributors_table)
#> [1] "author:\n John M. Smith:\n name: John M. Smith\n affiliation: '1,2'\n role:\n - Formal analysis\n - Visualization\n corresponding: yes\n email: some@email.com\n address: Enter postal address here\n Marton Kovacs:\n name: Marton Kovacs\n affiliation: '1,3,4'\n role:\n - Data curation\n - Methodology\n - .na.character\n corresponding: no\n Lex W. Luthor:\n name: Lex W. Luthor\n affiliation: '2,5'\n role:\n - Formal analysis\n - Funding acquisition\n - Software\n - Supervision\n - .na.character\n corresponding: no\n\naffiliation:\n - id: 1\n institution: Institute of Psychology, ELTE Eotvos Lorand University, Budapest,\n Hungary, Doctoral School of Psychology\n - id: 2\n institution: LexCorp, Smallville, Kansas, US\n - id: 3\n institution: Department of Psychology\n - id: 4\n institution: Institute for Interstellar Relations, Oxbridge University, UK\n - id: 5\n institution: Metropolis University\n"
Create funding acknowledgements section
For this section it is possible to use initials by setting the
initials
argument TRUE
.
print_funding(contributors_table = my_contributors_table, initials = TRUE)
#> [1] "J.M.S. and L.W.L. were supported by Important Fund; M.K. was supported by National Funding Agency."
Create a conflict of interest statement
For this section it is possible to use the initials by setting the
initials
argument TRUE
.
print_conflict_statement(contributors_table = my_contributors_table, initials = FALSE)
#> [1] "John M. Smith, Marton Kovacs, and Lex W. Luthor declare no competing interest."