Knowledge Base Article

Calling R Functions Defined In Other Text File From Sisense

Problem
In some cases, you want to capture a series of R commands in a text file, and you want to execute them from Sisense (edit formula).
Solution

Write script that will handle and manipulate the arguments you send from Sisense

  1. Open RGui or RStudio.
  2. Write the script that will handle the arguments you send from Sisense, make sure you use function syntax (subprogram that returns values).
RGui script editor
Or
RStudio script editor
  • Save the script in R working directory or another path in R server machine.

Load R script commands to Sisense edit formula

  • The setwd() function is setting working directory of the folder path where we saved our R script.
  • The source() function instructs R to read the text file and execute its contents.
  • Sisense arguments accessed to R script by calling the name of the function in the script (example line 3).
  • Save function/model for future usage.
Discussion
R is a general-purpose programming language, so we can use it to automate analysis and create new functions that extend the existing language features. You can capture series of R commands in a text file and execute them from Sisense.
References
Updated 02-05-2024
No CommentsBe the first to comment