0

I am trying to port existing R code, to BigR. But the dist method triggers an error in the ported code.

Existing code:

    mydata <- read.csv2("mydata.csv",header=T, sep=";", dec=",")

    d1 <- dist(x = mydata,method = "euclidean")

Ported code:

    mydata <- bigr.frame(dataSource="DEL", 
                      dataPath="/user/bigr/mydata.csv", delimiter=";", 
                      header=T, useMapReduce=T)

    d1 <- tableApply(data = mydata,
                     rfunction = function(df) {
                       dist(df, method="euclidean")
                     })

will output this error:

    Error: BigR[.bigr.jdbc.query.helper]: Error code : -1, SQLState : 02001
    Caused by : originating expression ends at <string> (line: 4, column: 20): java.lang.RuntimeException: Wrong number of fields on input at position 132
     originating expression ends at <string> (line: 4, column: 20)
        at com.ibm.jaql.lang.expr.core.Expr.eval(Expr.java:883)
        at com.ibm.jaql.lang.expr.core.DoExpr.evalRaw(DoExpr.java:160)
        at com.ibm.jaql.lang.expr.core.Expr.eval(Expr.java:871)
        at com.ibm.jaql.lang.expr.top.QueryExpr.evalRaw(QueryExpr.java:104)
        at com.ibm.jaql.lang.expr.core.Expr.eval(Expr.java:871)
        at com.ibm.jaql.lang.ParsedJaql.iter(ParsedJaql.java:243)
        at com.ibm.biginsights.bigsql.jdbc.driver.service.JaqlQueryProcessor.execute2(JaqlQueryProcessor.java:121)
        at com.ibm.biginsights.bigsql.jdbc.driver.service.JaqlQueryProcessor.execute(JaqlQueryProcessor.java:88)
        at com.ibm.biginsights.bigsql.jdbc.driver.service.XQEJDBCDriverService.execute2(XQEJDBCDriverService.java:553)
        at com.ibm.biginsights.
    In addition: Warning message:
    In is.na(parm) : is.na() applied to non-(list or vector) of type 'closure'
peleitor
  • 459
  • 7
  • 24
  • You may have mentioned what you expect others to help you with as well – Amir Jan 20 '16 at 20:35
  • Perhaps check to see the class of object `dist` returns and see if it is compatible with the function `tableApply` , and ditto for yur conversion of `mydata` – Carl Witthoft Jan 20 '16 at 20:44
  • Thanks for your comments. Where I need help is: make the result of tableApply (or equivalent groupApply, or rowApply) to fit into the data frame d1. tableApply handles bigr.frame objects. – peleitor Jan 21 '16 at 12:46

0 Answers0