1 Reply Latest reply: Nov 27, 2017 4:03 AM by Adam Karolewski RSS

    Problem with the R Plugin

    Igor Alcantara

      I have Sense Server November 2017 release. I have installed the R Plugin and I am able to run the R examples provided. So, apparently the plugin is working.

       

      However, when I try to use it with my own data I am not able to make it work.

       

      For example, if I add a text object and write the following expression, I get no result. Not even an error, just a blank text. There are absolutely no blank values.

       

      R.ScriptEval('mean(q$BMI);', BMI)

       

      Issue number 2:

      When I try to execute an R command in the script, I get this error "Client specified an invalid argument."

       

      This is the code. The source R file runs fine in R Studio.

       

      TempR:

      LOAD '$(vRSource)' As RSource

      Autogenerate 1;

       

      R:

      NoConcatenate

      LOAD

      R.ScriptEvalStr('source(q$RSource);', RSource) as R_Output

      Resident TempR;

        • Re: Problem with the R Plugin
          Adam Karolewski

          1. As I noticed in all examples when they indicate data they write like this: BMI as bmi. I am  not sure if it matters but if there are no other ideas I would try.

          2. For aggregations you need to use aggregate versions of the function:

          R.ScriptAggr('mean(q$BMI);' BMI as BMI)

          3. You need to be careful when using Str version of the function and passing numerical data. Maybe you could use:

          R.ScriptEvalExStr('N', 'source(q$RSource);', RSource as RSource)