| Title: | Generate Reports from `subfoldr2` Objects |
|---|---|
| Description: | Facilitates generation of .Rmd and .html reports from tables, (code) blocks and figures (plots and windows) saved using the subfoldr2 package. To quickly view all the results use `sbr_knit_results()`. The `sbr_n()` and `sbr_s()` functions can be used to insert numbers or strings saved using subfoldr2. |
| Authors: | Joe Thorley [aut, cre] (ORCID: <https://orcid.org/0000-0002-7683-4592>), Seb Dalgarno [aut] (ORCID: <https://orcid.org/0000-0002-3658-4517>), Duncan Kennedy [ctb] (ORCID: <https://orcid.org/0009-0001-4880-5751>), Poisson Consulting [cph, fnd] |
| Maintainer: | Joe Thorley <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-01 05:04:29 UTC |
| Source: | https://github.com/poissonconsulting/subreport |
Returns a string of the report code blocks in markdown format ready for inclusion in a report.
sbr_blocks( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, main = subfoldr2::sbf_get_main() )sbr_blocks( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, main = subfoldr2::sbf_get_main() )
x_name |
A string of the regular expression to match file names. |
sub |
A string of the path to the root sub folder. |
report |
A string of the path to the report folder. |
tag |
A string of the regular expression that the tag must match to be included. |
drop |
A character vector specifying the sub folders and file names to exclude from the report or NULL. |
keep |
A character vector specifying the highest level sub folders to keep that are not in drop. If NULL all highest level subfolders that are not in drop are kept. |
sort |
A character vector specifying the initial sort order for sub folders and file names or NULL. Missing items appear afterwards in alphabetical order. |
rename |
A unique named character vector specifying new heading names for sub folders or NULL. By default sub folder names have the first letter of each word capitalized. |
nheaders |
A count of the number of sub folder levels to assign headers to. |
header1 |
A count of the heading level for the first sub folder level. |
main |
A string of the path to the main folder. |
A string of the code blocks in markdown format.
Returns a string of the report plots and windows in markdown format ready for inclusion in a report. If a window and plot have identical names then the plot is dropped.
sbr_figures( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, main = subfoldr2::sbf_get_main(), width = 6, pre_num = getOption("sbr.pre_num_fig", 0L) )sbr_figures( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, main = subfoldr2::sbf_get_main(), width = 6, pre_num = getOption("sbr.pre_num_fig", 0L) )
x_name |
A string of the regular expression to match file names. |
sub |
A string of the path to the root sub folder. |
report |
A string of the path to the report folder. |
tag |
A string of the regular expression that the tag must match to be included. |
drop |
A character vector specifying the sub folders and file names to exclude from the report or NULL. |
keep |
A character vector specifying the highest level sub folders to keep that are not in drop. If NULL all highest level subfolders that are not in drop are kept. |
sort |
A character vector specifying the initial sort order for sub folders and file names or NULL. Missing items appear afterwards in alphabetical order. |
rename |
A unique named character vector specifying new heading names for sub folders or NULL. By default sub folder names have the first letter of each word capitalized. |
nheaders |
A count of the number of sub folder levels to assign headers to. |
header1 |
A count of the heading level for the first sub folder level. |
main |
A string of the path to the main folder. |
width |
A number of the page width in inches. |
pre_num |
A count specifying the number of pre-existing items. |
A string of the plots in markdown format.
Get Report
sbr_get_report()sbr_get_report()
A string specifying the report directory.
sbr_get_report()sbr_get_report()
Makes a results .Rmd file of the tables, code blocks and plots (and windows) and knits it into a .html file and opens in the default web browser.
sbr_knit_results( file = "results", report = sbr_get_report(), sub = character(0), main = subfoldr2::sbf_get_main(), quiet = FALSE, browse = TRUE, browser = "open" )sbr_knit_results( file = "results", report = sbr_get_report(), sub = character(0), main = subfoldr2::sbf_get_main(), quiet = FALSE, browse = TRUE, browser = "open" )
file |
A string of the file name(s) without an extension. |
report |
A string of the directory to save the tables, code blocks and plots. |
sub |
A string specifying the path to the sub folder (by default the current sub folder). |
main |
A string specifying the path to the main folder (by default the current main folder) |
quiet |
An option to suppress printing during rendering from knitr,
pandoc command line and others. To only suppress printing of the last
"Output created: " message, you can set |
browse |
A flag specifying whether to open the .html file in a web browser. |
browser |
a non-empty character string giving the name of the program to be used as the HTML browser. It should be in the PATH, or a full path specified. Alternatively, an R function to be called to invoke the browser. Under Windows |
An invisible path to the .Rmd file.
Get Number
sbr_number(x_name, sub = character(0)) sbr_n(x_name, sub = character(0))sbr_number(x_name, sub = character(0)) sbr_n(x_name, sub = character(0))
x_name |
A string of the name. |
sub |
A string specifying the path to the sub folder (by default the current sub folder). |
A number.
Returns a string of the numbers in markdown list(s) format ready for inclusion in a report.
sbr_numbers( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, numbered = FALSE, main = subfoldr2::sbf_get_main() )sbr_numbers( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, numbered = FALSE, main = subfoldr2::sbf_get_main() )
x_name |
A string of the regular expression to match file names. |
sub |
A string of the path to the root sub folder. |
report |
A string of the path to the report folder. |
tag |
A string of the regular expression that the tag must match to be included. |
drop |
A character vector specifying the sub folders and file names to exclude from the report or NULL. |
keep |
A character vector specifying the highest level sub folders to keep that are not in drop. If NULL all highest level subfolders that are not in drop are kept. |
sort |
A character vector specifying the initial sort order for sub folders and file names or NULL. Missing items appear afterwards in alphabetical order. |
rename |
A unique named character vector specifying new heading names for sub folders or NULL. By default sub folder names have the first letter of each word capitalized. |
nheaders |
A count of the number of sub folder levels to assign headers to. |
header1 |
A count of the heading level for the first sub folder level. |
numbered |
A flag specifying whether the list(s) items should be numbered. |
main |
A string of the path to the main folder. |
A string of the numbers in markdown format.
Reset Report
sbr_reset_report(rm = FALSE, ask = getOption("sbr.ask", TRUE))sbr_reset_report(rm = FALSE, ask = getOption("sbr.ask", TRUE))
rm |
A flag specifying whether to remove the folder and all its contents if it already exists. |
ask |
A flag specifying whether to ask before removing the existing folder. |
An invisible copy of the string "report".
The directory is created when needed if it doesn't already exist.
sbr_set_report(..., rm = FALSE, ask = getOption("sbf.ask", TRUE))sbr_set_report(..., rm = FALSE, ask = getOption("sbf.ask", TRUE))
... |
One or more character vectors which are combined together. |
rm |
A flag specifying whether to remove the folder and all its contents if it already exists. |
ask |
A flag specifying whether to ask before removing the existing folder. |
An invisible string of the path to the main folder.
Get String
sbr_string(x_name, sub = character(0)) sbr_s(x_name, sub = character(0))sbr_string(x_name, sub = character(0)) sbr_s(x_name, sub = character(0))
x_name |
A string of the name. |
sub |
A string specifying the path to the sub folder (by default the current sub folder). |
A string.
Returns a string of the report strings in markdown list(s) format ready for inclusion in a report.
sbr_strings( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, numbered = FALSE, main = subfoldr2::sbf_get_main() )sbr_strings( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, numbered = FALSE, main = subfoldr2::sbf_get_main() )
x_name |
A string of the regular expression to match file names. |
sub |
A string of the path to the root sub folder. |
report |
A string of the path to the report folder. |
tag |
A string of the regular expression that the tag must match to be included. |
drop |
A character vector specifying the sub folders and file names to exclude from the report or NULL. |
keep |
A character vector specifying the highest level sub folders to keep that are not in drop. If NULL all highest level subfolders that are not in drop are kept. |
sort |
A character vector specifying the initial sort order for sub folders and file names or NULL. Missing items appear afterwards in alphabetical order. |
rename |
A unique named character vector specifying new heading names for sub folders or NULL. By default sub folder names have the first letter of each word capitalized. |
nheaders |
A count of the number of sub folder levels to assign headers to. |
header1 |
A count of the heading level for the first sub folder level. |
numbered |
A flag specifying whether the list(s) items should be numbered. |
main |
A string of the path to the main folder. |
A string of the code blocks in markdown format.
Returns a string of the report tables in markdown format ready for inclusion in a report.
sbr_tables( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, main = subfoldr2::sbf_get_main(), sigfig = 4L, sigfig_override = NULL )sbr_tables( x_name = ".*", sub = character(0), report = sbr_get_report(), tag = ".*", drop = NULL, keep = NULL, sort = NULL, rename = NULL, nheaders = 2L, header1 = 4L, main = subfoldr2::sbf_get_main(), sigfig = 4L, sigfig_override = NULL )
x_name |
A string of the regular expression to match file names. |
sub |
A string of the path to the root sub folder. |
report |
A string of the path to the report folder. |
tag |
A string of the regular expression that the tag must match to be included. |
drop |
A character vector specifying the sub folders and file names to exclude from the report or NULL. |
keep |
A character vector specifying the highest level sub folders to keep that are not in drop. If NULL all highest level subfolders that are not in drop are kept. |
sort |
A character vector specifying the initial sort order for sub folders and file names or NULL. Missing items appear afterwards in alphabetical order. |
rename |
A unique named character vector specifying new heading names for sub folders or NULL. By default sub folder names have the first letter of each word capitalized. |
nheaders |
A count of the number of sub folder levels to assign headers to. |
header1 |
A count of the heading level for the first sub folder level. |
main |
A string of the path to the main folder. |
sigfig |
A positive integer of the significant figures to use when formatting numbers. This is applied to all tables. |
sigfig_override |
A named vector of table names and the number of significant figures to use. This will override the default set in |
A string of the tables in markdown format.
Creates a bibliography.bib file in the root directory.
sbr_use_bibliography()sbr_use_bibliography()
Creates a knit-report.R file in the root directory.
sbr_use_knit_report()sbr_use_knit_report()
Creates knit-report.R, bibliography.bib and and knit-report.R files in the root directory.
sbr_use_knit_report_all()sbr_use_knit_report_all()
Creates a report.Rmd file in the root directory.
sbr_use_report()sbr_use_report()