Reads a data frame with header/footnote information and attaches it to an rtf_doc object.The most effective way to use this function is to pass information to a custom reader for your process. See Details section for more information.

titles_and_footnotes_from_df(
  doc,
  from.df = NULL,
  from.file = NULL,
  reader = NULL,
  ...
)

Arguments

doc

A rtf_doc object to append header and footnote information.

from.df

A data.frame object with title and footnote information.

from.file

A file path to a file with title and footnote information.

reader

A function to read the data from the from.file argument.

...

Parameters passed to read_hf where they are processed and constructed into hf_line objects.

Value

A rtf_doc object with header/footnote information attached.

Details

Titles_and_footnotes_from_df allows you to attach titles and footnotes (as hf_line objects) from a data.frame. This data.frame could be a data.frame in your local environment, or read in from an external file. The best way to utilize this method is to create a custom reader function. This custom reader function is a function that you develop to:

  • Read a source file into a data.frame

  • Preprocess as necessary to keep only necessary records and variables

  • Ensure that variables are the correct data type

Titles_and_footnotes_from_df allows you to pass arguments into the reader function, which gives you the capability to keep titles and footnotes for all of your outputs in a central file and pass a filtering option, or any additional parameters as necessary. For an example implementation, see our vignette.

Required Columns

The following columns are required fields in a data.frame passed to titles_and_footnotes_from_df:

  • type(character - 'title' or 'footnote')

  • text1(character)

  • text2(character)

  • align(character - left, right, center, or split)

  • bold(logical)

  • italic(logical)

  • font(character)

  • index(numeric)