Use ExPanD to Create a Notebook for Your EDA
The ‘ExPanDaR’ package offers a toolbox for interactive exploratory data analysis (EDA). You can read more about it here. The ‘ExPanD’ shiny app allows you to customize your analysis to some extent but often you might want to continue and extend your analysis with additional models and visualizations that are not part of the ‘ExPanDaR’ package.
Thus, I am currently developing an option to export the ‘ExPanD’ data and analysis to an R Notebook. While it is not ready for CRAN yet, it seems to work reasonably well and I would love to see some people trying it and letting me know about any bugs or other issues that they encounter. Hence, this blog post.
In order to test the new export option, you will first need to install the github version of the package.
The export option is not enabled by default to avoid that users that make the ExPanD app available online accidentally share their data. So, you need to enable it using the parameter
export_nb_option. Here, I use an ExPanD call using the short firm-year corporate data panel that comes with the ExPanDaR package.
ExPanD(df = russell_3000, df_def = russell_3000_data_def, df_name = "Russell 3000", config_list = ExPanD_config_russell_3000, export_nb_option = TRUE)
After ‘ExPanD’ has started, scroll to the bottom of the page to see the “Export Data and Code” button.
After clicking the button you should be rewarded with a download dialog that lets you store a zip file. The zip file contains two files
- A notebook file
- A data file
ExPanD_nb_data.RDatacontaining the data and variable definitions
Unzip the file and load the notebook file in RStudio. It contains the code to finalize the sample as well as to prepare all tables and visuals that are displayed by the ‘ExPanD’ app. When sourcing it to an HTML file you should see them rendered as expected.
If everything works as expected the next steps are up to you. Explore the code, modify it to as you please and integrate it in your own analysis.