dbreport | R Documentation |
Create reports from database tables, R table objects (data.table, data.frame, tibble)
dbreport( con = NULL, schema = NULL, tbl = NULL, column = NULL, entry = NULL, report_title = NULL, report_text = NULL, plot_distinct = TRUE, plot_type = c("lollipop", "bar_horiz", "treemap"), plot_limit = 40L, plot_limit_text = 20L, output_dir = NULL, output_file = NULL, output_format = rmarkdown::html_document(theme = "united", highlight = "tango", toc = TRUE, toc_float = TRUE, toc_collapsed = FALSE, toc_depth = 3, number_sections = FALSE), file = FALSE, file_format = c("csv", "json"), file_type = c("single", "multiple"), exit = TRUE, verbose = TRUE )
con |
Connection to database or an R-object (data.table, data.frame, tibble). Required. |
schema |
character; Database schema (if applicable). |
tbl |
character; Table to be used for summary report (if applicable). |
column |
character; Table columns that should be summarised in report. |
entry |
any; Specific table entries which should be comsidered in the summary table. |
report_title |
character; Title of summary report. |
report_text |
character or connection; User defined text input to add some description to the report. Default NULL - no text. Can be a character vector or a file. |
plot_distinct |
logical; Include plots of ordered distinct counts of each column entry in the report? |
plot_type |
character; Should a lollipop, barplot or treemap plot be produced? |
plot_limit |
integer; Limit distinct count axis in the plots. Default: 40L. |
plot_limit_text |
integer; Limit axis text to a certain length. Default: NULL (i.e. no limit is applied). |
output_dir |
character; To which directory should the output be saved? |
output_file |
character; File name of the report. |
output_format |
object; directly passed on to rmarkdown::render(). Default: html_document(theme = 'united', highlight = 'tango'). |
file |
logical; Should one or multiple files for each distinct column counts be created? |
file_format |
character; To which format should the file(s) be put out (csv, json). Multiple possible. |
file_type |
character; Output each column distinct counts set to a single or to multiple files. |
exit |
logical; Should database connections be closed after running dbreport(). Default: TRUE. |
verbose |
logical; Should a verbose output be printed to console? |
Columns with more than 10,000 individual entries are leveled off to avoid a too large RAM and storage footprint.
The function creates a markdown report and exports files
Andreas Scharmueller, andschar@protonmail.com
# creates a .html, .pdf, .doc via Rmarkdown dbreport( con = iris, report_title = 'My iris report', report_text = 'Here goes my text as an introduction to the report.', plot_distinct = TRUE, plot_type = 'lollipop', plot_limit = 10, # Limit your plot to the first 15 entries output_dir = file.path(tempdir(), 'iris'), output_file = 'test', file = TRUE, # Output single distinct counts to a file file_type = 'multiple', file_format = 'csv' )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.