Skip to Content
avatar image
Former Member

Execution of R script failed.;Timeout during R script execution or receiving result data undefined

Hi all I have the above error when I try to execute the following R script within Expert Analytics, which is connected to an Hana Server.

Did I miss something?

cannonballs <- function(cannons) {


  # VARIABLES FOR ITERATION CREATION
  diversi_anni = unique(cannons$anno)
  diversi_mesi = unique(cannons$mese)
  diversi_gg = unique(cannons$giorno)
  diverse_ore = unique(cannons$ora)
  
  # CREATION OF FINAL DATA STRUCTURE
  cannoni_output <- data.frame(
    PONumber=double(),
    id=double(),
    temp=double(),
    umi=double(),
    anno=double(),
    mese=double(),
    giorno=double(),
    ora=double(),
    latitude=double(),
    longitude=double(),
    cluster=double()
  )
  
  # FOR EACH HOUR OF EACH DAY OF EACH MONTH OF EACH YEAR
library(dynamicTreeCut)
  
  for(year in diversi_anni){
    for(month in diversi_mesi){
      for(day in diversi_gg){
        for(hour in diverse_ore){
          # SUBSET DATA
          sub_ora = subset(cannons, cannons$ora == hour & cannons$giorno == day & cannons$mese == month & cannons$anno == year)
          
          if(nrow(sub_ora)>=3){
            # DATA CLEANING FOR CLUSTERING
            var_clust = sub_ora
            var_clust$id=NULL
            var_clust$ora=NULL
            var_clust$giorno=NULL
            var_clust$mese=NULL
            var_clust$anno=NULL
            var_clust$PONumber=NULL
            var_clust$latitude=NULL
            var_clust$longitude=NULL
            var_clust$umi = scale(var_clust$umi)
            var_clust$temp = scale(var_clust$temp)
            if(is.nan(var_clust$umi)){var_clust$umi=sub_ora$umi}
            if(is.nan(var_clust$temp)){var_clust$umi=sub_ora$temp}
            
            # DISTANCE CALCULATION
            d = dist(var_clust)
            
            # HIERARCHICAL CLUSTERING
            c = hclust(d, method="ward.D2")
            
            # TREE CUTTING
            members = cutreeDynamicTree(c, maxTreeHeight = 5, minModuleSize = 2 )
            #members = cutree(c, k = 2)
            sub_ora$cluster = members
            cannoni_output = rbind(cannoni_output, sub_ora)
          } 
        }
      }
    }
  }


  return(list(out=cannoni_output))
  
};
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Sep 07, 2017 at 08:15 AM

    Hi Dumitru,

    Did you specify in the R extension the columns (name and data type) your extension is outputting?

    In order to reduce complexity and to narrow the problem down, I find it helpful test the R extension in Expert mode connecting to a local file first. Once that is working, I suggest to move to HANA.

    Many Greetings

    Andreas

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 07, 2017 at 02:10 PM

    Hi Dumitru, Andreas means that Expert Analytics connects to a local file, instead of connecting to SAP HANA. Kind regards, Antoine

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 07, 2017 at 12:20 PM

    Hi Andreas,

    thank you for your kind reply. The code is working on a local file, but it doesn't on Hana.

    What do you mean by Expert mode?

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 15, 2017 at 07:19 AM

    Former Member were you able to resolve your problem? Kind regards Antoine Chabert

    Add comment
    10|10000 characters needed characters exceeded