View source: R/report_tbl_dbi.R
diagnose_paged_report.tbl_dbi | R Documentation |
The diagnose_paged_report() paged report the information for diagnosing the quality of the DBMS table through tbl_dbi.
## S3 method for class 'tbl_dbi'
diagnose_paged_report(
.data,
output_format = c("pdf", "html")[1],
output_file = NULL,
output_dir = tempdir(),
browse = TRUE,
title = "Data Diagnosis Report",
subtitle = deparse(substitute(.data)),
author = "dlookr",
abstract_title = "Report Overview",
abstract = NULL,
title_color = "white",
subtitle_color = "gold",
thres_uniq_cat = 0.5,
thres_uniq_num = 5,
flag_content_zero = TRUE,
flag_content_minus = TRUE,
flag_content_missing = TRUE,
cover_img = NULL,
create_date = Sys.time(),
logo_img = NULL,
theme = c("orange", "blue")[1],
sample_percent = 100,
in_database = FALSE,
collect_size = Inf,
as_factor = TRUE,
...
)
.data |
a tbl_dbi. |
output_format |
report output type. Choose either "pdf" and "html". "pdf" create pdf file by rmarkdown::render() and pagedown::chrome_print(). so, you needed Chrome web browser on computer. "html" create html file by rmarkdown::render(). |
output_file |
name of generated file. default is NULL. |
output_dir |
name of directory to generate report file. default is tempdir(). |
browse |
logical. choose whether to output the report results to the browser. |
title |
character. title of report. default is "Data Diagnosis Report". |
subtitle |
character. subtitle of report. default is name of data. |
author |
character. author of report. default is "dlookr". |
abstract_title |
character. abstract title of report. default is "Report Overview". |
abstract |
character. abstract of report. |
title_color |
character. color of title. default is "white". |
subtitle_color |
character. color of title. default is "gold". |
thres_uniq_cat |
numeric. threshold to use for "Unique Values - Categorical Variables". default is 0.5. |
thres_uniq_num |
numeric. threshold to use for "Unique Values - Numerical Variables". default is 5. |
flag_content_zero |
logical. whether to output "Zero Values" information. the default value is TRUE, and the information is displayed. |
flag_content_minus |
logical. whether to output "Minus Values" information. the default value is TRUE, and the information is displayed. |
flag_content_missing |
logical. whether to output "Missing Value" information. the default value is TRUE, and the information is displayed. |
cover_img |
character. name of cover image. |
create_date |
Date or POSIXct, character. The date on which the report is generated. The default value is the result of Sys.time(). |
logo_img |
character. name of logo image on top right. |
theme |
character. name of theme for report. support "orange" and "blue". default is "orange". |
sample_percent |
numeric. Sample percent of data for performing Diagnosis. It has a value between (0, 100]. 100 means all data, and 5 means 5% of sample data. This is useful for data with a large number of observations. |
in_database |
Specifies whether to perform in-database operations. If TRUE, most operations are performed in the DBMS. if FALSE, table data is taken in R and operated in-memory. Not yet supported in_database = TRUE. |
collect_size |
a integer. The number of data samples from the DBMS to R. Applies only if in_database = FALSE. |
as_factor |
logical. whether to convert to factor when importing a character type variable from DBMS table into R. |
... |
arguments to be passed to pagedown::chrome_print(). |
Generate generalized data diagnostic reports automatically. You can choose to output to pdf and html files. This is useful for diagnosing a data frame with a large number of variables than data with a small number of variables.
Create an PDF through the Chrome DevTools Protocol. If you want to create PDF, Google Chrome or Microsoft Edge (or Chromium on Linux) must be installed prior to using this function. If not installed, you must use output_format = "html".
No return value. This function only generates a report.
Reported from the data diagnosis is as follows.
Overview
Data Structures
Job Informations
Warnings
Variables
Missing Values
List of Missing Values
Visualization
Unique Values
Categorical Variables
Numerical Variables
Categorical Variable Diagnosis
Top Ranks
Numerical Variable Diagnosis
Distribution
Zero Values
Minus Values
Outliers
List of Outliers
Individual Outliers
diagnose_paged_report.data.frame
.
# If you have the 'DBI' and 'RSQLite' packages installed, perform the code block:
if (FALSE) {
library(dplyr)
# Generate data for the example
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 20), "platelets"] <- NA
heartfailure2[sample(seq(NROW(heartfailure2)), 5), "smoking"] <- NA
# connect DBMS
con_sqlite <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
# copy heartfailure2 to the DBMS with a table named TB_HEARTFAILURE
copy_to(con_sqlite, heartfailure2, name = "TB_HEARTFAILURE", overwrite = TRUE)
# reporting the diagnosis information -------------------------
# create pdf file. file name is Diagnosis_Paged_Report.pdf
con_sqlite %>%
tbl("TB_HEARTFAILURE") %>%
diagnose_paged_report()
# create pdf file. file name is Diagn.pdf, and collect size is 250
con_sqlite %>%
tbl("TB_HEARTFAILURE") %>%
diagnose_paged_report(collect_size = 250, output_file = "Diagn.pdf")
# Disconnect DBMS
DBI::dbDisconnect(con_sqlite)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.