Title: | Generate CRediT Author Statements |
---|---|
Description: | A tiny package to generate CRediT author statements (<https://credit.niso.org/>). It provides three functions: create a template, read it back and generate the CRediT author statement in a text file. |
Authors: | Josep Pueyo-Ros [aut, cre] , Marcelo S. Perlin [rev] (@msperlin), João Martins [rev] (@zambujo) |
Maintainer: | Josep Pueyo-Ros <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0.9000 |
Built: | 2024-12-04 05:58:08 UTC |
Source: | https://github.com/ropensci/CRediTas |
The function transforms the information in the template
(from template_create
) to a raw string following the CRediT authors
statement format of "author1: contributions author2: contributions ..."
cras_write( cras_table, file, drop_authors = TRUE, overwrite = FALSE, markdown = TRUE, quiet = FALSE )
cras_write( cras_table, file, drop_authors = TRUE, overwrite = FALSE, markdown = TRUE, quiet = FALSE )
cras_table |
A data.frame created using |
file |
The text file to be created. If not provided (default), the statement is returned as a string instead of written to a file. |
drop_authors |
If TRUE (default) the authors without contributions are removed from the statement. If FALSE, they are kept without contributions assigned. |
overwrite |
If TRUE, the file is overwritten. Otherwise, a error is triggered. |
markdown |
If TRUE (default), the authors are surrounded by ** to make them bold in markdown. |
quiet |
If TRUE and |
A text file with the CRediT authors statement or, if file is NULL
(default), a character vector of length 1 with the statement that can be
used in a Rmarkdown or quarto document using inline code:
`r cras_write(cras_table, markdown = TRUE)`
# Generate a template and populate it (randomwly for this example) cras_table <- template_create(authors = c("Josep Maria", "Jane Doe")) cras_table[,2:ncol(cras_table)] <- sample(0:1, (ncol(cras_table)-1)*2, replace = TRUE) # Create a temporary file just for this example file <- tempfile() # Write to the file cras_write(cras_table, file, markdown = TRUE) # Check the content of the file readLines(file)
# Generate a template and populate it (randomwly for this example) cras_table <- template_create(authors = c("Josep Maria", "Jane Doe")) cras_table[,2:ncol(cras_table)] <- sample(0:1, (ncol(cras_table)-1)*2, replace = TRUE) # Create a temporary file just for this example file <- tempfile() # Write to the file cras_write(cras_table, file, markdown = TRUE) # Check the content of the file readLines(file)
Create a template to fill the CRediT author statement. (https://credit.niso.org). The template is a table where the authors are the rows and the columns are the roles.
template_create(authors, file, roles = roles_get())
template_create(authors, file, roles = roles_get())
authors |
A character vector with all the authors to be included in the statement. |
file |
If a path is provided, the template is saved as a csv for excel |
roles |
A character vector with the roles to be included in the statement. If NULL, it uses all the roles defined in the CRediT author statement. |
The dataframe can be edited in R or, if file is provided, it is exported to a csv to be edited manually in your preferred csv editor. The csv is created to be compatible with Microsoft Excel, since it is the most popular spreadsheet software among scientists. Therefore, it is separated by semicolon.
A dataframe with a row for each author and a column for each role, filled with zeros.
template_create(authors = c("Josep Maria", "Jane Doe"))
template_create(authors = c("Josep Maria", "Jane Doe"))
The template should be created using create_template()
template_read(file)
template_read(file)
file |
A character vector with the path to the csv file |
a data.frame with the content of the csv file
# Create a temporary file for this example file <- tempfile() # Create a template and save it to a csv file template_create(authors = c("Josep Maria", "Jane Doe"), file = file) # Read the template back (in real life once it has been populated) template_read(file)
# Create a temporary file for this example file <- tempfile() # Create a template and save it to a csv file template_create(authors = c("Josep Maria", "Jane Doe"), file = file) # Read the template back (in real life once it has been populated) template_read(file)