Export a figure/table, and its caption and alternative text, to an rda object. Typically used after stockplotr::extract_caps_alttext().

export_rda(
  object = NULL,
  caps_alttext = NULL,
  figures_tables_dir = NULL,
  topic_label = NULL,
  fig_or_table = NULL
)

Arguments

object

The final figure (ggplot) or table (flextable) object.

caps_alttext

The object containing a figure's caption and alternative text, in a list, or a table's caption, likely generated with stockplotr::extract_caps_alttext().

figures_tables_dir

If the user has already created folders containing figures and tables ("figures" and "tables"), figures_tables_dir represents the location of these folders. Otherwise, these two folders will be created automatically, then used to store the exported rda files.

topic_label

A string that describes a figure or table's label. These labels are found in the "label" column of the "captions_alt_text.csv" file and are used to link the figure or table with its caption/alt text.

fig_or_table

A string describing whether the plot is a figure or table.

Value

An rda file with a figure's ggplot, caption, and alternative text, or a table's flextable and caption.

Examples

if (FALSE) { # \dontrun{
export_rda(
  final = final_table_object,
  caps_alttext = caps_alttext_object,
  figures_tables_dir = here::here(),
  topic_label = "bnc",
  fig_or_table = "table"
)

export_rda(
  final = final_figure_object,
  caps_alttext = another_caps_alttext_object,
  figures_tables_dir = "my_figures_tables_dir",
  topic_label = "landings",
  fig_or_table = "figure"
)
} # }