| Title: | A Simple Author Handler for Scientific Writing |
|---|---|
| Description: | Handles and formats author information in scientific writing in 'R Markdown' and 'Quarto'. 'plume' provides easy-to-use and flexible tools for inserting author data in 'YAML' as well as generating author and contribution lists (among others) as strings from tabular data. |
| Authors: | Arnaud Gallou [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-1002-4247>) |
| Maintainer: | Arnaud Gallou <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.3.0.9000 |
| Built: | 2026-06-02 09:22:45 UTC |
| Source: | https://github.com/arnaudgallou/plume |
Thin wrapper around cat() to display vector elements on distinct lines when
rendering an R Markdown or Quarto document.
as_lines(...)as_lines(...)
... |
Objects to print. |
NULL, invisibly.
aut <- Plume$new(encyclopedists) as_lines(aut$get_affiliations())aut <- Plume$new(encyclopedists) as_lines(aut$get_affiliations())
Helper function returning the 14 contributor roles of
the Contributor Roles Taxonomy (CRediT). This function is the default argument of the
roles and role_cols parameters in plume classes and plm_template(),
respectively.
credit_roles(oxford_spelling = TRUE)credit_roles(oxford_spelling = TRUE)
oxford_spelling |
Should the suffix -ize/-ization be used? |
A named vector.
credit_roles()credit_roles()
Data on four notable authors of the Encyclopédie (originally "Encyclopédie,
ou dictionnaire raisonné des sciences, des arts et des métiers") published in
France in the second half of the 18th century. The dataset is available in
English (encyclopedists) and French (encyclopedists_fr).
encyclopedists encyclopedists_frencyclopedists encyclopedists_fr
A tibble with 4 rows and 10 variables:
authors' given names
authors' family names
authors' email addresses
authors' phone numbers
authors' ORCID
authors' affiliations
authors that supervised the project
authors involved in the writing
special notes about authors
encyclopedists encyclopedists_frencyclopedists encyclopedists_fr
Wrapper around glue_collapse() using sep = ", "
and last = " and " as default arguments.
enumerate(x, sep = ", ", last = " and ")enumerate(x, sep = ", ", last = " and ")
x |
A character vector. |
sep |
Separator used to separate the terms. |
last |
Separator used to separate the last two items if |
A character string with the same class as x.
aut <- Plume$new(encyclopedists) enumerate(aut$get_author_list())aut <- Plume$new(encyclopedists) enumerate(aut$get_author_list())
Create an ORCID icon for use with the Plume class. This is only supported
in R Markdown.
icn_orcid(size = 16, bw = FALSE)icn_orcid(size = 16, bw = FALSE)
size |
Size of the icon (in pixels). |
bw |
Should the black and white version of the icon be used? |
A plume icon, i.e. an object with S3 class plm_icon.
aut <- Plume$new(encyclopedists, orcid_icon = icn_orcid(bw = TRUE))aut <- Plume$new(encyclopedists, orcid_icon = icn_orcid(bw = TRUE))
Plume
Set the symbols used in a Plume object.
plm_symbols( affiliation = NULL, corresponding = "*", note = c("†", "‡", "§", "¶", "#", "**") )plm_symbols( affiliation = NULL, corresponding = "*", note = c("†", "‡", "§", "¶", "#", "**") )
affiliation, corresponding, note
|
Character vectors of symbols to use,
or |
A named list.
aut <- Plume$new( encyclopedists, symbols = plm_symbols(affiliation = letters) ) aut$get_author_list("^a^")aut <- Plume$new( encyclopedists, symbols = plm_symbols(affiliation = letters) ) aut$get_author_list("^a^")
Create an empty tibble that can be used as a template to supply author data.
plm_template(minimal = TRUE, role_cols = credit_roles(), credit_roles = FALSE)plm_template(minimal = TRUE, role_cols = credit_roles(), credit_roles = FALSE)
minimal |
If |
role_cols |
A vector of names defining role columns to create. If the vector contains key-value pairs, columns will be named after the keys. |
credit_roles |
It is now recommended to use |
An empty tibble.
plm_template() plm_template(role_cols = paste0("role_", 1:5))plm_template() plm_template(role_cols = paste0("role_", 1:5))
Plume provides several methods to generate author information directly
within an R Markdown or Quarto document. This is a convenient solution when
you don't need preformatted reports.
In some cases, Plume gives you greater control over the formatting of
author information, as it supports features not available in PlumeQuarto.
new_plume() is an alias for Plume$new().
plume::NameHandler -> plume::PlumeHandler -> plume::StatusSetter -> plume::StatusSetterPlume -> Plume
new()
Create a Plume object.
Plume$new( data, names = NULL, roles = credit_roles(), symbols = plm_symbols(), credit_roles = FALSE, initials_given_name = FALSE, dotted_initials = TRUE, family_name_first = FALSE, distinct_initials = FALSE, interword_spacing = TRUE, orcid_icon = icn_orcid(), by = NULL )
dataA data frame containing author data.
namesA vector of key-value pairs specifying custom names to use, where keys are default names and values their respective replacements.
rolesA vector of key-value pairs defining roles where keys identify role columns and values describe the actual roles to use.
symbolsSymbols, as defined by plm_symbols(), used to link
authors to their metadata. Special Markdown characters are
automatically escaped internally.
credit_rolesIt is now recommended to use roles = credit_roles() to use the
Contributor Roles Taxonomy.
initials_given_nameShould the initials of given names be used?
dotted_initialsShould initials be dot-separated?
family_name_firstShould literal names show family names first?
distinct_initialsIf TRUE, will expand identical initials with
additional letters from the last word of their respective family name
until initials are unique. Initials of authors sharing the exact same
name will remain in the short form.
interword_spacingShould literal names use spacing? This parameter is only useful for people writing in languages that don't separate words with a space such as Chinese or Japanese.
orcid_iconThe ORCID icon, as defined by icn_orcid(), to be
used. Only supported in R Markdown.
byA character string defining the default variable used to assign
specific metadata to authors in all set_*() methods. By default, uses
authors' id.
A Plume object.
get_author_list()
Get the list of authors.
Plume$get_author_list(suffix = NULL, format = deprecated())
suffix lets you choose which symbol categories to suffix authors with,
using the following keys:
a for affiliations
c for corresponding authors
n for notes
o for ORCID icons (only supported in R Markdown)
The order of the keys determines the order of symbol types. For example,
"ac" shows affiliation ids first and corresponding author mark second,
when "ca" shows corresponding author mark first and affiliation ids
second. Use "," to separate and "^" to superscript symbols.
Set to NULL or "" to list authors without suffixes.
A character vector.
get_affiliations()
Get authors' affiliations.
Plume$get_affiliations(superscript = TRUE, sep = "")
superscriptShould affiliation ids be superscripted?
sepSeparator used to separate affiliation ids and affiliations.
A character vector.
get_notes()
Get authors' notes.
Plume$get_notes(superscript = TRUE, sep = "")
superscriptShould note ids be superscripted?
sepSeparator used to separate note ids and notes.
A character vector.
get_orcids()
Get authors' ORCID.
Plume$get_orcids(compact = FALSE, icon = TRUE, sep = "")
compactShould links only display the 16-digit identifier?
iconShould the ORCID icon be shown? This is only supported in R Markdown.
sepSeparator used to separate authors and their respective ORCID.
A character vector.
get_contact_details()
Get the contact details of corresponding authors.
Plume$get_contact_details(
template = "{details} ({name})",
email = TRUE,
phone = FALSE,
fax = FALSE,
url = FALSE,
sep = ", ",
format = deprecated()
)templateA glue specification that uses the
variables name and/or details.
email, phone, fax, urlArguments equal to TRUE are evaluated and
passed to the variable details. By default, only email is set to
TRUE.
sepSeparator used to separate details items.
formatPlease use the parameter template instead.
A character vector.
get_contributions()
Get authors' contributions.
Plume$get_contributions( roles_first = TRUE, by_author = FALSE, alphabetical_order = FALSE, literal_names = FALSE, divider = ": ", sep = ", ", sep_last = " and ", dotted_initials = deprecated() )
roles_firstIf TRUE, displays roles first and authors second. If
FALSE, roles follow authors.
by_authorShould roles be grouped by author?
alphabetical_orderShould authors be listed in alphabetical order? By default, lists authors in the order they are defined in the data.
literal_namesShould literal names be used?
dividerSeparator used to separate roles from authors.
sepSeparator used to separate roles or authors.
sep_lastSeparator used to separate the last two roles or authors if more than one item is associated to a role or author.
dotted_initialsPlease use the dotted_initials parameter of Plume$new() instead.
A character vector.
clone()
The objects of this class are cloneable with this method.
Plume$clone(deep = FALSE)
deepWhether to make a deep clone.
# Create a Plume instance aut <- Plume$new(encyclopedists) # Set the desired corresponding authors, using # authors' id by default aut$set_corresponding_authors(1, 4) # Listing authors, followed by affiliation ids # and the corresponding author mark: aut$get_author_list("^a,c^") # Or maybe with the corresponding author mark # coming before affiliation ids: aut$get_author_list("^c,a^") # Getting more author metadata aut$get_affiliations() aut$get_contributions() # Use `symbols` to change the default symbols. # E.g. to use letters as affiliation ids: aut <- Plume$new( encyclopedists, symbols = plm_symbols(affiliation = letters) ) aut$get_author_list("^a^") aut$get_affiliations() # It is also possible to output contributions in the # active voice aut <- Plume$new( encyclopedists, roles = c( supervision = "supervised the project", writing = "contributed to the Encyclopédie" ) ) aut$get_contributions(roles_first = FALSE, divider = " ")# Create a Plume instance aut <- Plume$new(encyclopedists) # Set the desired corresponding authors, using # authors' id by default aut$set_corresponding_authors(1, 4) # Listing authors, followed by affiliation ids # and the corresponding author mark: aut$get_author_list("^a,c^") # Or maybe with the corresponding author mark # coming before affiliation ids: aut$get_author_list("^c,a^") # Getting more author metadata aut$get_affiliations() aut$get_contributions() # Use `symbols` to change the default symbols. # E.g. to use letters as affiliation ids: aut <- Plume$new( encyclopedists, symbols = plm_symbols(affiliation = letters) ) aut$get_author_list("^a^") aut$get_affiliations() # It is also possible to output contributions in the # active voice aut <- Plume$new( encyclopedists, roles = c( supervision = "supervised the project", writing = "contributed to the Encyclopédie" ) ) aut$get_contributions(roles_first = FALSE, divider = " ")
PlumeQuarto allows you to add or update author data in YAML files or the
YAML header of Quarto documents. The generated YAML complies with Quarto's
author and affiliations schemas. Use this class when working with journal
templates.
new_plume_quarto() is an alias for PlumeQuarto$new().
plume::NameHandler -> plume::PlumeHandler -> plume::StatusSetter -> plume::StatusSetterPlumeQuarto -> PlumeQuarto
plume::PlumeHandler$data()plume::PlumeHandler$get_plume()plume::PlumeHandler$get_roles()plume::PlumeHandler$print()plume::PlumeHandler$roles()plume::StatusSetter$set_corresponding_authors()plume::StatusSetterPlumeQuarto$set_cofirst_authors()plume::StatusSetterPlumeQuarto$set_deceased()plume::StatusSetterPlumeQuarto$set_equal_contributor()new()
Create a PlumeQuarto object.
PlumeQuarto$new( data, file, names = NULL, roles = credit_roles(), credit_roles = FALSE, initials_given_name = FALSE, dotted_initials = TRUE, by = NULL )
dataA data frame containing author data.
fileA .qmd, .yml or .yaml file to insert author data into.
namesA vector of key-value pairs specifying custom names to use, where keys are default names and values their respective replacements.
rolesA vector of key-value pairs defining roles where keys identify columns and values describe the actual roles to use.
credit_rolesIt is now recommended to use roles = credit_roles() to use the
Contributor Roles Taxonomy.
initials_given_nameShould the initials of given names be used?
dotted_initialsShould initials be dot-separated?
byA character string defining the default variable used to assign
specific metadata to authors in all set_*() methods. By default, uses
authors' id.
A PlumeQuarto object.
to_yaml()
Add or update author data in the input file.
PlumeQuarto$to_yaml()
The input file, invisibly.
clone()
The objects of this class are cloneable with this method.
PlumeQuarto$clone(deep = FALSE)
deepWhether to make a deep clone.
# Create a simple temporary YAML file containing a title tmp_file <- tempfile(fileext = ".yml") readr::write_lines("title: Encyclopédie", tmp_file) # View the temporary file cat(readr::read_file(tmp_file)) # Create a PlumeQuarto instance using the temporary file # we've just created aut <- PlumeQuarto$new( encyclopedists, file = tmp_file ) # And add author data to the YAML file aut$to_yaml() cat(readr::read_file(tmp_file)) # Running the method again with new data updates the YAML # accordingly aut <- PlumeQuarto$new( dplyr::slice(encyclopedists, 2), file = tmp_file ) aut$to_yaml() cat(readr::read_file(tmp_file)) # Clean up unlink(tmp_file)# Create a simple temporary YAML file containing a title tmp_file <- tempfile(fileext = ".yml") readr::write_lines("title: Encyclopédie", tmp_file) # View the temporary file cat(readr::read_file(tmp_file)) # Create a PlumeQuarto instance using the temporary file # we've just created aut <- PlumeQuarto$new( encyclopedists, file = tmp_file ) # And add author data to the YAML file aut$to_yaml() cat(readr::read_file(tmp_file)) # Running the method again with new data updates the YAML # accordingly aut <- PlumeQuarto$new( dplyr::slice(encyclopedists, 2), file = tmp_file ) aut$to_yaml() cat(readr::read_file(tmp_file)) # Clean up unlink(tmp_file)
Modifier function used to generate logical sequences of characters.
sequential(x)sequential(x)
x |
A character vector. |
A character vector with parent S3 class sequential.
aut <- Plume$new( tibble::tibble( given_name = "X", family_name = "Y", affiliation = 1:60 ), symbols = plm_symbols(affiliation = sequential(letters)) ) aut$get_affiliations(sep = ": ", superscript = FALSE)aut <- Plume$new( tibble::tibble( given_name = "X", family_name = "Y", affiliation = 1:60 ), symbols = plm_symbols(affiliation = sequential(letters)) ) aut$get_affiliations(sep = ": ", superscript = FALSE)
This function allows you to set new default names to a plume subclass, for example to set default names to a language other than English.
set_default_names(..., .plume_quarto = FALSE)set_default_names(..., .plume_quarto = FALSE)
... |
Key-value pairs where keys are default names and values their respective replacements. |
.plume_quarto |
Are you setting new names for |
See vignette("plume") for the list of available names.
A named list.
# Extending `Plume` with default names in French PlumeFr <- R6::R6Class( classname = "PlumeFr", inherit = Plume, private = list( names = set_default_names( initials = "initiales", literal_name = "nom_complet", corresponding = "correspondant", given_name = "prénom", family_name = "nom", email = "courriel", phone = "téléphone" ) ) ) PlumeFr$new(encyclopedists_fr)# Extending `Plume` with default names in French PlumeFr <- R6::R6Class( classname = "PlumeFr", inherit = Plume, private = list( names = set_default_names( initials = "initiales", literal_name = "nom_complet", corresponding = "correspondant", given_name = "prénom", family_name = "nom", email = "courriel", phone = "téléphone" ) ) ) PlumeFr$new(encyclopedists_fr)