View source: R/build_summary.R
build_summary | R Documentation |
Build a site summary report based on user input files.
build_summary(
dir_data = NULL,
file_main = "_metadata.xlsx",
sheet_main = "metadata",
file_prefix_sep = "_",
rmd_template = NULL,
output_format = "html",
output_file = NULL
)
dir_data |
Directory name with files. |
file_main |
Main metadata file. Default = '_metadata.xlsx' |
sheet_main |
Sheet name in file_main with metadata. Default = 'metadata' |
file_prefix_sep |
File names separator for prefix used in 'Order' column to sort the files for inclusion in the summary report. Default = '_' |
rmd_template |
Path and file name of RMD used to generate the summary report. Default = NULL (internal package) |
output_format |
File type for output (html only). Default = 'html' |
output_file |
Output file path. Default = working directory |
This function will create a site summary report based on files provided by the user.
There will be a main metadata file (Excel) that references the other files. The files will be used in the file order they are listed.
* Prefix
+ File prefix
* Type
+ Figure, Table, Text, or Header
* Caption
+ Caption of line item
Can also include "text" or "header" lines.
"text" will be inserted as plain text.
"header" with a number (e.g., Header1 or Header2 or Header3) will be use the Caption to generate header text in the output.
"figures" can be one of any image type (e.g., png, jpg, or pdf). All images should be in the same format.
"tables" are only allowed as CSV files at this time.
Output is a self contained HTML file (default). Future plans for PDF and Word (docx) formats.
Special characters (e.g, #, by R into ".". Nor can table column headers start with a number. R will translate them to an "X".
Special characters in text do not always get translated properly.
Returns summary report in the specified format (HTML, PDF, or Word).
# Copy Example Files to TempDir
file.copy(system.file("extdata/report", package="ContDataSumViz")
, tempdir()
, recursive = TRUE)
# Inputs
dir_data <- file.path(tempdir(), "report")
file_main <- "_Captions_SiteX.xlsx"
sheet_main <- "metadata"
file_prefix_sep <- "_"
rmd_template <- system.file("rmd/SiteSummary.Rmd"
, package="ContDataSumViz")
output_format <- "html"
output_file <- file.path(tempdir()
, paste0("SiteSummary.", output_format))
build_summary(dir_data = dir_data
, file_main = file_main
, sheet_main = sheet_main
, file_prefix_sep = file_prefix_sep
, rmd_template = rmd_template
, output_format = output_format
, output_file = output_file)
# Open tempdir (Windows only)
# shell.exec(tempdir())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.