A new R package for Business Analytics... radiant
Written by Matt Dancho on February 1, 2022
I’m super impressed by the
radiant R package. With no prior experience with radiant, I was able to complete a short business analytics report in under 10-minutes.
This article is part of R-Tips Weekly, a weekly video tutorial that shows you step-by-step how to do common R coding tasks.
Here are the links to get set up. 👇
See how in 10-minutes I made a quick business analytics report with
What you make in this R-Tip
By the end of this tutorial, you’ll use Radiant to create a reproducible Business Analytics Report and save it as HTML.
Reproducible Business Analytics Report (made with
Thank You Developers
Before we go any further, I want to say thanks to the open source developers of Radiant. The programmer that graciously developed
radiant and has given it to us free of charge is Vincent Nijs.
Follow these instructions to set up the
radiant package and tutorial.
- Install Radiant
- Load the libraries and data
radiant()(there’s also an Add-In if you use Rstudio)
Radiant’s Shiny UI
This opens up the Radiant Shiny User Interface, a Shiny App that runs locally in a new Google Chrome Window.
Step 1 - Working with Data
Next, lets load our data. I added data into the Rstudio Global Environment previously when I ran
One of the options is to load data from the Global Environment, so let’s do this.
Step 2 - Visualize
We can make a quick plot to investigate the sales data over time by Sales ID (store - department identifier). This highlights the differing sales trends by Store-Department.
- Head over the Visualize Section within the Data Tab
- Select Line Plot, and Y-Axis will be Weekly Sales, X-Axis is Date, and Facet Row is ID
- Click Create Plot to make the visualization
Step 3 - Starting the Report
At this point we can begin building our report.
- On the Visualize Section, scroll down and click the little report icon
- This send you to the Report Tab where you can Knit report
Bada-Bing… Bada Boom! We have the beginnings of a Business Analytics Report.
Step 4 - Modeling (Creating a Price Model)
The next step in our workflow is to model the weekly sales data. My goal is to create a Pricing Model that looks for dependencies between the weekly sales volume by department and factors like markups, fuel price, temperature (weather), etc. We can easily do this in
Head over to the Model Tab and select Linear Regression (OLS).
- First select Weekly Sales as the response variable and select the explanatory variables shown.
- Then click Estimate Model to make a linear regression model
- Review the OLS Linear regression summary results. This is our very basic pricing model.
Bonus - Residual & Coefficient Plots
As a bonus for making it this far, I’m showing you how you can quickly make some awesome visuals for your Business Analytics Report.
This plot helps us see how well the model is performing. It’s worth mentioning that we are seeing a lot of clusters, which means a non-linear model may be a better model.
This plot helps us see the effect of a 1-unit change to the modeled price. It appears that the model is very sensitive to Fuel Price. Keep in mind that the units are important for comparison.
- A change in $1 of fuel price is a lot.
- A change in 1-degree Fahrenheit for Temperature is not that much.
Step 5 - Finish the Report
Once we are happy, we can finish our report. Just hit the “Report Button” to send the results from the Modeling Tab to the Report Tab.
On the reporting tab:
- Add a title and sections to your report
- Move the code chunks to follow the order
- Hit Save Report (I saved as HTML in the Youtube Video)
The report is saved as an HTML document (assuming you switched from Notebook to HTML like I did in the video.)
You just created a report using
radiant. But there’s a lot more to data science.
If you’d like to become a data scientist (and have an awesome career, improve your quality of life, enjoy your job, and all the fun that comes along), then I can help with that.
Step 1: Watch my Free 40-Minute Webinar
Learning data science on your own is hard. I know because IT TOOK ME 5-YEARS to feel confident.
AND, I don’t want it to take that long for you.
So, I put together a FREE 40-minute webinar (a masterclass) that provides a roadmap for what worked for me.
Literally 5-years of learning, consolidated into 40-minutes. It’s jammed packed with value. I wish I saw this when I was starting… It would have made a huge difference.
Step 2: Take action
For my action-takers, if you are ready to take your skills to the next level and DON’T want to wait 5-years to learn data science for business, AND you want a career you love that earns you $100,000+ salary (plus bonuses), and you’d like someone to help you do this in UNDER 6-MONTHS or less….
Then I can help with that too. There’s a link in the FREE 40-minute webinar for a special price (because you are special!) and taking that action will kickstart your journey with me in your corner.
Get ready. The ride is while. And the destination is AMAZING!
👇 Top R-Tips Tutorials you might like:
- mmtable2: ggplot2 for tables
- ggdist: Make a Raincloud Plot to Visualize Distribution in ggplot2
- ggside: Plot linear regression with marginal distributions
- DataEditR: Interactive Data Editing in R
- openxlsx: How to Automate Excel in R
- officer: How to Automate PowerPoint in R
- DataExplorer: Fast EDA in R
- esquisse: Interactive ggplot2 builder
- gghalves: Half-plots with ggplot2
- rmarkdown: How to Automate PDF Reporting
- patchwork: How to combine multiple ggplots
- Geospatial Map Visualizations in R
Want these tips every week? Join R-Tips Weekly.