Skip to contents

Save a data frame of article metadata as both a CSV file and an HTML file with a markdown-styled table. Options are provided to control file format outputs and verbosity.

Usage

save_report(input, filename, save_csv, save_html, title, cols, width, verbose, outdir)

Arguments

input

A data frame containing article data (e.g., "title", "summary", "url").

filename

A character string specifying the base filename.

save_csv

Logical. Save output as a CSV file? Default is TRUE.

save_html

Logical. Save output as an HTML file? Default is TRUE.

title

A character string specifying the HTML page title. Default is "Article Summary Report".

cols

A character vector of column names to include in the output. Default is c("title", "summary").

width

A numeric vector of column widths for the HTML table. Default is c(1, 3).

verbose

Logical. Should messages be printed? Default is TRUE.

outdir

A character string specifying the directory to save files. Default is current working directory ".".

Value

Files are written to disk in the specified formats. The function returns (invisibly) a list of saved file paths.

Details

A timestamp is appended to the base filename to uniquely identify each output. If both save_csv and save_html are FALSE, no files are saved and a message is issued (if verbose = TRUE).

Examples

if (FALSE) { # \dontrun{
papers <- get_articles(journal = "Nature Medicine")
papers_with_summary <- add_summary(papers)
save_report(papers_with_summary, save_csv = TRUE, save_html = TRUE)
} # }