Using the R Script Editor

Objectives

After completing this lesson, you will be able to:

  • Identify the key functionality of the R script editor in SAP Analytics Cloud

R Script Editor

The SAP Analytics Cloud R script editor is similar to the one used in RStudio.

The R script editor is a four screen panel that allows you to:

  • paste and execute your R code
  • monitor warnings and error messages
  • view data information
  • preview your visualization

R Script Editor

In the following video, learn move about the editor, console, environment, and preview panels of the R script editor in SAP Analytics Cloud.

Use Suggested Code in the R Script Editor

Suggested Code

A list of suggested code is displayed if you press Ctrl+Space, or if there are multiple suggestions based on the characters you've typed in the R script editor.

Based on your coding context, the available R functions, data frames, R packages, vectors, arguments, input parameters, and function lists appear on the left with a corresponding description (if available) on the right.

  • To reference a data frame, enter the three letters of the data frame name.
  • You can use the up, down, PgUp, PgDn, Home, and End keys to navigate the displayed list of suggestions. Select a suggestion to insert it into your script.
  • If you combine a data frame name with $, a list of the column names for the data frame is displayed.

R Code Snippets

Code Snippets and Examples

Sample scripts to render R-based visualizations are provided for your convenience.

The code and visualizations rendered by these samples are for instructional purposes, but you can use these samples to generate visualizations based on your data.

To access the snippets and examples, navigate to <> and choose Snippets or Examples.

Examples of R Visualizations and the Associated R Code

By choosing insert and R visualization, you can create a wide variety of charts using a script from R.

Here are a few examples of R visualizations and the associated R code from the R code script editor:

Bubble Chart

Diverging Bars

Scatterplot

Up and Down Arrows Based on KPI

Word Clouds

Log in to track your progress & complete quizzes