4 Replies Latest reply: Apr 16, 2018 5:07 AM by Yannick Camaro RSS

    Return multiple columns in a table

    Yannick Camaro

      Hello,

       

      I'm using R.ScriptEval to add a column "Cluster" to the dataset Iris but I can't return 2 columns with Load * Extension.

       

      I have the following error message :


      Rserve error: The method or operation is not implemented.


      I can only return 1 column. I tried to copy the same code as R_BasicExample.


      My code :

       

      [Iris]:

      LOAD

      [Id],

      [SepalLengthCm] AS [sL],

      [SepalWidthCm] AS [sl],

      [PetalLengthCm] AS [pL],

      [PetalWidthCm] AS [pl],

      [Species] AS [Nom]

      FROM [lib://Mes Data/Iris.csv]

      (txt, codepage is 28591, embedded labels, delimiter is ',', msq);

       

      [Cluster_NotOk_2_Col]:

      Load *

      Extension R.ScriptEval('q$cluster<-kmeans(cbind(q$sL,q$sl,q$pL,q$pl), centers = 3, nstart=20)$cluster;qRes <-data.frame(Cluster = q$cluster,Id = q$Id);qRes;',Iris{Id,sL,sl,pL,pl});

       

      /*


      [Cluster_Ok_1_Col]:

      Load *

      Extension R.ScriptEval('kmeans(q, centers = 3, nstart=20)$cluster;',Iris{sL,sl,pL,pl});


      */


      If someone could help me or know the answer it would be nice