This function takes a data frame with two columns (Author, Affiliation), deduplicates authors and affiliations while preserving their original order, optionally adds custom author notes (e.g., "*", "#"), and writes the formatted author list and affiliation footnotes into a .Rmd file compatible with bookdown::word_document2 output.

generate_and_write_author_rmd(
  df,
  file,
  affiliation_df = NULL,
  author_note = NULL
)

Arguments

df

A data frame with two columns: the first for author names and the second for affiliations.

file

Character. Output file path (e.g., "authors.Rmd") to write the formatted content.

affiliation_df

Optional. A data frame of affiliations to define a fixed ordering. If NULL, uses unique order from df.

author_note

Optional. A data frame with two columns: Author and Note, specifying symbol(s) (e.g., *, #) to append to each author.

Value

Invisibly returns a list with author_line and affiliation_list components.