library(flexdashboard) library(ggplot2) library(burro) library(dplyr) library(plotly) #skimr::fix_windows_histograms() if(!exists("dataset")){ data(diamonds) dataset <- diamonds #dataset_name <- deparse(substitute(dataset)) # stop("You need to input a dataset") } options(DT.options = list(scrollY="100vh")) #dataset <- diamonds my_data_table <- burro::check_data(dataset) numericVars <- attr(my_data_table, "numericVars") categoricalVars <- attr(my_data_table, "categoricalVars") outcome_var <- attr(my_data_table, "outcome_var") cat_no_outcome <- attr(my_data_table, "cat_no_outcome") dataOut <- reactive({ my_data_table }) #use rmarkdown::run() to run app #https://somtom.github.io/post/using-dynamically-rendered-r-markdown-childs-for-reports/ #https://www.andrewheiss.com/blog/2020/01/01/flexdashboard-dynamic-data/
plotOutput("visdat") output$visdat <- renderCachedPlot({ visdat::vis_dat(data.frame(dataOut()), palette = "cb_safe") + theme(axis.text.x = element_text(size = 15, angle = 45)) }, cacheKeyExpr= {dataOut()} )
#not interactive - using knitr.print defaults to make it look better skimr::skim(my_data_table)
fillCol( DT::DTOutput("data_dict") ) output$data_dict <- DT::renderDT({ #print(data_dictionary) if(is.null(data_dictionary)){ return(NULL) } DT::datatable(data_dictionary, options=list(pageLength=50)) })
burro:::cat_single_ui("category", categoricalVars) burro:::cat_single_server("category", dataOut, dataset_name)
burro:::cat_outcome_ui("outcome", outcome_var, cat_no_outcome) burro:::cat_outcome_server("outcome", dataOut)
burro:::cat_tabular_ui(id="tabular", categoricalVars) burro:::cat_tabular_server(id="tabular", dataOut)
burro:::cat_missing_ui("missing", categoricalVars) burro:::cat_missing_server("missing", dataOut)
burro:::cont_hist_ui("histogram", numericVars) burro:::cont_hist_server("histogram", dataOut)
burro:::cont_boxplot_ui(id="boxplot", numericVars, categoricalVars) burro:::cont_boxplot_server(id="boxplot", dataOut)
burro:::cont_scatter_ui(id="corr_plot", numericVars) burro:::cont_scatter_server(id="corr_plot", dataOut)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.