Creating a story using R visualizations

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Explain R visualization components
  • Create a story using R visualizations
  • Add input controls

Initial steps

R visualization components

An R visualization is based on the following components:

  1. Table structure: Input data based on a model, specified dimensions, dimension attributes, and filters
  2. Input controls: Input parameters based on a calculation input control
  3. R code script: A script executed to generate the visualization

Table structure

Once you have created your story, selected your data source, and added your R visualization to the story the R visualization structure pane will open on the right side of the screen. You must specify the table structure for your input data.

  1. Select + Add Input Data and use the Table Structure settings to specify the table structure for your input data.
  2. Select the Expand icon under Designer to view a preview of the input data table structure.
    • Rows: Choose +Add Dimensions to add dimensions from the list of available options into your input data.
    • Columns: Use this to manage the available measures. Choose All Members to display the currently available measures.
    • Filters: Use this to manage the filters for the input data.
The Input Data preview with city, period, and year selected for Rows and Account selected for Columns. The data is filtered by category.

Input controls

You can also configure an input parameter for your visualization.

When you select Add Input Parameter, you will be able to select an input control. If the story already contains calculation input controls, you will be able to choose any of the listed parameters.

You can choose between:

  1. Existing Dimension  to allow users to pick from members of a dimension
  2. Static List  to add custom values as options for the input control

In the example below, Existing Dimension was selected.

Dialog for calculation input control, showing Name, Properties (model and dimension) and Input values.

R code script

Using the example below, you can see the data, R code, and the final visualization created.

Two columns. To the left a chart of data and on the right the r code to create the R visualization.

When your R code has been written, you can add the controls to the R visualization in SAP Analytics Cloud. The R code and controls enable the user to create the visualization, in this example, comparing one Texas city to all of the others.

An R visualization of housing data in Texas. There is a filter on the left to allow the user to interact with the data to highlight data for a specific city.

Create an R visualization

Task 1: Add an R visualization

Business example

You work for an up and coming microbrewery in Melbourne and you have been invited to present at a national conference on the brewing trends and potential growth areas for microbreweries in Australia. You want to create a story with advanced visualizations so you decide to use the R visualization functionality in SAP Analytics Cloud.

Task flow

In this practice exercise, you will perform the following tasks:

  1. Add an R visualization to a story
  2. Add input data from a source file using the story Builder pane
  3. Create a dataset and configure it in the Data view
  4. Add dimensions using the Input Data panel
  5. Add and edit a script using the R script editor
  6. Add the R visualization to your story

Add input control to a story

Task 1: Add an input control to a story

Business example

You want to create a story with advanced visualizations where you can interact with the data.

Task flow

In this practice exercise, you will perform the following tasks:

  1. Add an input control to your story
  2. Add filters to the dimension

Save progress to your learning plan by logging in or creating an account

Login or Register