Skip to contents

The function generates rmarkdown formatted text of the contributions according to the CRediT taxonomy. The output is generated from an contributors_table validated with the validate_contributors_table() function. The contributors_table must be based on the contributors_table_template(). The function can return the output string as rmarkdown or html formatted text or without any formatting.

Usage

print_credit_roles(
  contributors_table,
  text_format = "rmd",
  initials = FALSE,
  order_by = "role"
)

Arguments

contributors_table

Tibble. Validated contributors_table

text_format

Character. Formatting of the returned string. Possible values: "rmd", "html", "raw". "rmd" by default.

initials

Logical. If true initials will be included instead of full names in the output

order_by

Character. Whether the contributing authors listed for each role ("role"), or the roles are listed after the name of each contributor ("contributor").

Value

The function returns a string containing the CRediT roles with the contributors listed for each role they partake in.

Warning

The function is primarily developed to be the part of a shiny app. As the validation is handled inside of the app separately, the function can break with non-informative errors if running locally without first validating it.

See also

Examples

example_contributors_table <- read_contributors_table(
contributors_table = system.file("extdata",
"contributors_table_example.csv", package = "tenzing", mustWork = TRUE))
#> 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.
print_credit_roles(contributors_table = example_contributors_table)
#> **Conceptualization:** Marton Kovacs.  
#> **Data curation:** John M. Smith and Lex W. Luthor.  
#> **Funding acquisition:** John M. Smith and Marton Kovacs.  
#> **Methodology:** Marton Kovacs.  
#> **Project administration:** John M. Smith and Lex W. Luthor.  
#> **Resources:** Lex W. Luthor.  
#> **Supervision:** Marton Kovacs.  
#> **Writing - original draft:** Lex W. Luthor.  
#> **Writing - review & editing:** Lex W. Luthor.