| Title: | Author Metadata Management and Manuscript Front Matter |
|---|---|
| Description: | Manage author metadata and generate manuscript front matter, including title pages, acknowledgements, conflicts of interest, and contributions, with support for large author lists. |
| Authors: | Zhipeng Cao [aut, cre] |
| Maintainer: | Zhipeng Cao <[email protected]> |
| License: | AGPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-05-25 10:31:31 UTC |
| Source: | https://github.com/zh1peng/authordown |
A convenience wrapper that calls the various section generators and combines them into one text block. Ideal for quick copy-paste into Word.
authordown( data, title = NULL, style = "default", show_degree = FALSE, acknowledgement_style = "paragraph", conflict_style = "paragraph", contribution_style = "paragraph" )authordown( data, title = NULL, style = "default", show_degree = FALSE, acknowledgement_style = "paragraph", conflict_style = "paragraph", contribution_style = "paragraph" )
data |
A data frame with the columns needed by each function:
|
title |
Optional paper title to pass to |
style |
Title page style ("default", "APA", "Nature"). |
show_degree |
Logical. If TRUE, include Degree after author names. |
acknowledgement_style |
Output style for acknowledgements. |
conflict_style |
Output style for conflicts of interest. |
contribution_style |
Output style for contributions. |
A character string containing all sections.
## Not run: authors <- read.csv("authordown_template.csv") cat(authordown(authors, title = "My Great Paper", style = "default")) ## End(Not run)## Not run: authors <- read.csv("authordown_template.csv") cat(authordown(authors, title = "My Great Paper", style = "default")) ## End(Not run)
Reads a CSV/TSV/XLSX file and returns a standardized data frame. By default, the data are validated for required columns and basic formats.
authordown_read_local(path, sheet = NULL, validate = TRUE)authordown_read_local(path, sheet = NULL, validate = TRUE)
path |
Path to a local CSV, TSV, or XLSX file. |
sheet |
Optional sheet name or index for XLSX files. |
validate |
Logical. If TRUE, validate the data. |
A data frame with standardized columns.
## Not run: authors <- authordown_read_local("authors.csv") ## End(Not run)## Not run: authors <- authordown_read_local("authors.csv") ## End(Not run)
Copies a standard author metadata template from the package into the requested path. Use this to start a new project with the expected columns and example values.
authordown_template(path = "authordown_template.csv", format = NULL)authordown_template(path = "authordown_template.csv", format = NULL)
path |
Output file path. Extension determines format if |
format |
Optional format override: |
Invisibly returns the output path.
## Not run: authordown_template("authors.csv") authordown_template("authors.xlsx") ## End(Not run)## Not run: authordown_template("authors.csv") authordown_template("authors.xlsx") ## End(Not run)
Checks required columns and key formats such as order, email, ORCID, and corresponding author rules.
authordown_validate(data, require_affiliations = FALSE)authordown_validate(data, require_affiliations = FALSE)
data |
A data frame of author metadata. |
require_affiliations |
Logical. If TRUE, require at least one affiliation column. |
The validated, standardized data frame.
authors <- data.frame(FirstName = "Alice", LastName = "Smith") authordown_validate(authors)authors <- data.frame(FirstName = "Alice", LastName = "Smith") authordown_validate(authors)
Combines acknowledgements provided by the authors into a single, coherent sentence. The function ignores author names (as they are assumed to be included in the acknowledgement text itself) and simply concatenates each non-empty acknowledgement entry using a semicolon.
generate_acknowledgement(data, style = c("paragraph", "bullets", "numbered"))generate_acknowledgement(data, style = c("paragraph", "bullets", "numbered"))
data |
A data frame containing at least the column Acknowledgement. |
style |
Output style: "paragraph", "bullets", or "numbered". |
A character string with the combined acknowledgements.
authors <- data.frame( Acknowledgement = c("This work received support from resource X", "Resource Y was instrumental", "Alice Smith received support from resource ZZ"), stringsAsFactors = FALSE ) generate_acknowledgement(authors, style = "paragraph")authors <- data.frame( Acknowledgement = c("This work received support from resource X", "Resource Y was instrumental", "Alice Smith received support from resource ZZ"), stringsAsFactors = FALSE ) generate_acknowledgement(authors, style = "paragraph")
Produces a readable conflict statement. If all authors report no conflict, it states so. Otherwise, it lists the authors reporting conflicts and then indicates that the remaining authors declare no conflict.
generate_conflict(data, style = c("paragraph", "bullets", "numbered"))generate_conflict(data, style = c("paragraph", "bullets", "numbered"))
data |
A data frame containing at least the columns: FirstName, LastName, and Conflict. |
style |
Output style: "paragraph", "bullets", or "numbered". |
A character string with the formatted conflict statement.
authors <- data.frame( FirstName = c("Alice", "Bob"), LastName = c("Smith", "Johnson"), Conflict = c("No conflict", "Consultant at Company Z"), stringsAsFactors = FALSE ) generate_conflict(authors, style = "paragraph")authors <- data.frame( FirstName = c("Alice", "Bob"), LastName = c("Smith", "Johnson"), Conflict = c("No conflict", "Consultant at Company Z"), stringsAsFactors = FALSE ) generate_conflict(authors, style = "paragraph")
Combines each author's contribution statement into a clear paragraph. Each line indicates the author and their specific contribution.
generate_contribution( data, style = c("paragraph", "bullets", "numbered"), list_style = NULL )generate_contribution( data, style = c("paragraph", "bullets", "numbered"), list_style = NULL )
data |
A data frame containing at least the columns: FirstName, LastName, and Contribution. |
style |
Output style: "paragraph", "bullets", or "numbered". |
list_style |
Deprecated. Use |
A character string summarizing the author contributions.
authors <- data.frame( FirstName = c("Alice", "Bob"), LastName = c("Smith", "Johnson"), Contribution = c("Conceptualization; Data curation", "Supervision; Writing - review"), stringsAsFactors = FALSE ) generate_contribution(authors, style = "paragraph")authors <- data.frame( FirstName = c("Alice", "Bob"), LastName = c("Smith", "Johnson"), Contribution = c("Conceptualization; Data curation", "Supervision; Writing - review"), stringsAsFactors = FALSE ) generate_contribution(authors, style = "paragraph")
Creates a sample CSV (or Excel) with columns for authors, affiliations, acknowledgments, conflicts, etc.
generate_template(file = "authordown_template.csv", excel = FALSE)generate_template(file = "authordown_template.csv", excel = FALSE)
file |
A file path where the template should be written. Defaults to \"authordown_template.csv\" in the current directory. |
excel |
Logical. If TRUE, writes an Excel file (.xlsx) instead of CSV. |
Invisibly returns the data frame used for the template.
## Not run: generate_template() # writes authordown_template.csv ## End(Not run)## Not run: generate_template() # writes authordown_template.csv ## End(Not run)
Produces a journal-style title page text with:
An optional paper title
Author line (with superscript affiliation indices)
Affiliation list (labeled by superscript numbers)
Co-first author footnote (dagger symbol) if multiple authors share the same minimal rank
Corresponding author footnote (*) and contact line
The function expects columns:
FirstName, MiddleName, LastName (strings)
Rank (numeric), used to detect co-first authors (lowest rank)
Correspondence (logical or "TRUE"/"FALSE" string)
Email (for corresponding authors)
Affiliation1, Affiliation2, etc. (any number of these)
generate_title_page( data, style = c("default", "APA", "Nature"), title = NULL, show_degree = FALSE, co_first_footnote = TRUE )generate_title_page( data, style = c("default", "APA", "Nature"), title = NULL, show_degree = FALSE, co_first_footnote = TRUE )
data |
A data frame with the columns listed above. |
style |
Title page style. Supported values: "default", "APA", "Nature". |
title |
Optional character string for the paper title. |
show_degree |
Logical. If TRUE, include Degree after author names. |
co_first_footnote |
Logical. If |
A single character string suitable for copy-pasting into Word.
authors <- data.frame( FirstName = c("Alice", "Bob", "Charlie"), MiddleName = c("M.", "", "Q."), LastName = c("Smith", "Johnson", "Lee"), Degree = c("PhD", "MD", "PhD"), Email = c("[email protected]", "[email protected]", "[email protected]"), Rank = c(1, 1, 2), # Alice and Bob are co-first authors Correspondence = c(TRUE, FALSE, FALSE), Affiliation1 = c("University of X, Dept. of Y", "University of X, Dept. of Y", "Institute of Z"), Affiliation2 = c(NA, "Company W", NA), stringsAsFactors = FALSE ) cat(generate_title_page(authors, title = "A Great Paper", show_degree = TRUE))authors <- data.frame( FirstName = c("Alice", "Bob", "Charlie"), MiddleName = c("M.", "", "Q."), LastName = c("Smith", "Johnson", "Lee"), Degree = c("PhD", "MD", "PhD"), Email = c("[email protected]", "[email protected]", "[email protected]"), Rank = c(1, 1, 2), # Alice and Bob are co-first authors Correspondence = c(TRUE, FALSE, FALSE), Affiliation1 = c("University of X, Dept. of Y", "University of X, Dept. of Y", "Institute of Z"), Affiliation2 = c(NA, "Company W", NA), stringsAsFactors = FALSE ) cat(generate_title_page(authors, title = "A Great Paper", show_degree = TRUE))
This function takes a section title, a content-generating function, and a data frame, then produces an HTML file that displays the section header and its content. This generic function works for any section (e.g. Conflict of Interest, Author Contributions, Acknowledgements).
render_section_html( section_title, content_function, data, output_file = tempfile(fileext = ".html"), ... )render_section_html( section_title, content_function, data, output_file = tempfile(fileext = ".html"), ... )
section_title |
A character string for the section header (e.g., "Conflict of Interest"). |
content_function |
A function that accepts a data frame and returns a formatted character string. |
data |
A data frame containing the necessary columns. |
output_file |
The path to the output HTML file. Defaults to a temporary file. |
... |
Additional arguments passed to |
A character string with the path to the rendered HTML file.
## Not run: # To render the Conflict of Interest section: html_path <- render_section_html("Conflict of Interest", generate_conflict, authors) browseURL(html_path) ## End(Not run)## Not run: # To render the Conflict of Interest section: html_path <- render_section_html("Conflict of Interest", generate_conflict, authors) browseURL(html_path) ## End(Not run)