Custom R Component – Density Plots for Multiple Variables
Density plots can be helpful to understand the distribution of a variable. This component uses a feature introduced with SAP Predictive Analytics 2.2 to output multiple R charts
- A density plot that displays the distributions of all selected variables overlayed in the same chart
- Individual density plots for each selected variable
Please note that this component is not an official release by SAP and that it is provided as-is without any guarantee or support. Please test the component to ensure it works for your purposes.
R libraries ggplot2, reshape2 and RColorBrewer must be installed.
Please let me know should you encounter any limitations.
These parameters can be set by the user.
One or more numerical variables to be displayed in the density plots.
No output columns added by this component.
How to Implement
The component can be downloaded as .spar file from GitHub. Then deploy it as described here. You just need to import it through the option “Import/Model Component”, which you will find by clicking on the plus-sign at the bottom of the list of the available algorithms.
You can try out the component wtih our own data or with the file EuropeanUrbanAudit.csv. It contains a small part of a perception survey done by Eurostat in 2009 about the quality of life in 75 different European cities. Categories that were asked for are (in abbreviated terms): Affordable Housing, Availability of Good Jobs, Integration of Foreigners, Satisfaction with Public Transport, Cultural Facilities, Sport Facilities and Green Spaces. The number indicates a synthetic index of satisfaction (0-100). So the higher the value, the more satisfied people are.
The screenshot at the top of this article shows the overlay plot of all densities. Here is an example of one of the individual density plots.