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
.
Super classes
plume::NameHandler
-> plume::PlumeHandler
-> plume::StatusSetter
-> plume::StatusSetterPlume
-> Plume
Methods
Method new()
Create a Plume
object.
Usage
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
)
Arguments
data
A data frame containing author data.
names
A vector of key-value pairs specifying custom names to use, where keys are default names and values their respective replacements.
roles
A vector of key-value pairs defining roles where keys identify role columns and values describe the actual roles to use.
symbols
Symbols, as defined by
plm_symbols()
, used to link authors to their metadata. Special Markdown characters are automatically escaped internally.credit_roles
-
It is now recommended to use
roles = credit_roles()
to use the Contributor Roles Taxonomy. initials_given_name
Should the initials of given names be used?
dotted_initials
Should initials be dot-separated?
family_name_first
Should literal names show family names first?
distinct_initials
If
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_spacing
Should 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_icon
The ORCID icon, as defined by
icn_orcid()
, to be used. Only supported in R Markdown.by
A character string defining the default variable used to assign specific metadata to authors in all
set_*()
methods. By default, uses authors' id.
Method get_author_list()
Get the list of authors.
Details
suffix
lets you choose which symbol categories to suffix authors with,
using the following keys:
a
for affiliationsc
for corresponding authorsn
for noteso
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.
Method get_affiliations()
Get authors' affiliations.
Method get_notes()
Get authors' notes.
Method get_orcids()
Get authors' ORCID.
Method get_contact_details()
Get the contact details of corresponding authors.
Usage
Plume$get_contact_details(
template = "{details} ({name})",
email = TRUE,
phone = FALSE,
fax = FALSE,
url = FALSE,
sep = ", ",
format = deprecated()
)
Arguments
template
A glue specification that uses the variables
name
and/ordetails
.email, phone, fax, url
Arguments equal to
TRUE
are evaluated and passed to the variabledetails
. By default, onlyemail
is set toTRUE
.sep
Separator used to separate
details
items.format
-
Please use the parameter
template
instead.
Method get_contributions()
Get authors' contributions.
Usage
Plume$get_contributions(
roles_first = TRUE,
by_author = FALSE,
alphabetical_order = FALSE,
literal_names = FALSE,
divider = ": ",
sep = ", ",
sep_last = " and ",
dotted_initials = deprecated()
)
Arguments
roles_first
If
TRUE
, displays roles first and authors second. IfFALSE
, roles follow authors.by_author
Should roles be grouped by author?
alphabetical_order
Should authors be listed in alphabetical order? By default, lists authors in the order they are defined in the data.
literal_names
Should literal names be used?
divider
Separator used to separate roles from authors.
sep
Separator used to separate roles or authors.
sep_last
Separator used to separate the last two roles or authors if more than one item is associated to a role or author.
dotted_initials
-
Please use the
dotted_initials
parameter ofPlume$new()
instead.
Examples
# 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^")
#> Denis Diderot^1,\*^
#> Jean-Jacques Rousseau^2^
#> François-Marie Arouet^2^
#> Jean Le Rond d'Alembert^1,3,\*^
# Or maybe with the corresponding author mark
# coming before affiliation ids:
aut$get_author_list("^c,a^")
#> Denis Diderot^\*,1^
#> Jean-Jacques Rousseau^2^
#> François-Marie Arouet^2^
#> Jean Le Rond d'Alembert^\*,1,3^
# Getting more author metadata
aut$get_affiliations()
#> ^1^Université de Paris
#> ^2^Lycée Louis-le-Grand
#> ^3^Collège des Quatre-Nations
aut$get_contributions()
#> Supervision: D.D. and J.L.R.d'A.
#> Writing - original draft: D.D., J.-J.R., F.-M.A. and J.L.R.d'A.
# 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^")
#> Denis Diderot^a^
#> Jean-Jacques Rousseau^b^
#> François-Marie Arouet^b^
#> Jean Le Rond d'Alembert^a,c^
aut$get_affiliations()
#> ^a^Université de Paris
#> ^b^Lycée Louis-le-Grand
#> ^c^Collège des Quatre-Nations
# 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 = " ")
#> D.D. and J.L.R.d'A. supervised the project
#> D.D., J.-J.R., F.-M.A. and J.L.R.d'A. contributed to the Encyclopédie