Use ExPanD to Create a Notebook for Your EDA

[This article was first published on An Accounting and Data Science Nerd's Corner, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.

ExPanD export Notebook button

ExPanD export Notebook 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 ExPanD_nb_code.Rmd
  • A data file ExPanD_nb_data.RData containing 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.

ExPanD Notebook

ExPanD Notebook

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.

If anything does not work as expected please get in touch by opening an issue on github. Alternatively, you can reach me via email or twitter.


To leave a comment for the author, please follow the link and comment on their blog: An Accounting and Data Science Nerd's Corner. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)