The best way to understand how the R integration works is to think of Visual Analytics as the front end tool to help you rapidly create complex and meaningful visualizations of your statistical data analysis that is run using R. Using our calculated field designer, create calculated fields that invoke R commands and Visual Analytics will plot the resulting data similar to any other field.

The best way to understand how the R integration works is to think of Visual Analytics as the front end tool to help you rapidly create complex and meaningful visualizations of your statistical data analysis that is run using R. Using our calculated field designer, create calculated fields that invoke R commands and Visual Analytics will plot the resulting data similar to any other field.

Contents

Pre-requisites:

To start using R with Visual Analytics in Aqua Data Studio, both R and Rserve must be pre-installed. R is the statistical environment and Rserve is the TCP/IP server which allows other programs to use facilities of R. Rserve supports remote connection and authentication.
 

DOWNLOAD AND INSTALL R AND RSERVE 


1. User will be required to have R preinstalled:  http://cran.r-project.org
2. User will be required to have Rserve preinstalled: https://rforge.net/Rserve
3. Complete installation instructions for different OS are provided in our R installation page.

CONFIGURING R CONNECTION IN VA
  1. Visual Analytics > Window > Rserve Connection. This will launch the initial connection dialog where you can specify the host, port & optional credentials of your Rserve setup. "Test Connection", "Save" and Cancel buttons are provided.
  2. The connection information will not be saved in the user's workbook. Instead, it will be saved in datastudio.properties file. This means it will be shared across all your VA workbooks.
RUN FUNCTIONS WITH VARIABLES TYPES - CREATE CALCULATED FIELDS WITH R EXPRESSIONS
  • The Calculated Field Dialog will now offer 2 new table calc functions: SCRIPT_INT and SCRIPT_REAL.  ("R script", <measure fields>). The "R script" can contains .argn which specifies the measure field values to use. The function names denote the return value type from R.
    • e.g. SCRIPT_INT("is.finite(.arg1)", SUM([Profit]))
    • e.g. SCRIPT_INT('result <- kmeans(data.frame(.arg1,.arg2,.arg3,.arg4), 3);result$cluster;', SUM([Petal length]), SUM([Petal width]), SUM([Sepal length]), SUM([Sepal width]))
  • SCRIPT_INT -> RInteger
  • SCRIPT_REAL -> RDouble
  • The R script result must be either a scalar or vector of length one that is replicated for all rows, or a vector of length equal to the number of rows in the VA result table.

  • To support string fields as input parameters into the SCRIPT_X functions, Visual Analytics support ATTR() function.



  • No labels