Skip to main content
Question

R conversion error in RAGG

  • January 21, 2020
  • 3 replies
  • 1 view

Could you please help with a question about using R in celonis? I only start to use function such as RCALL and RAGG. My analisys requeres work with dates and time, so I have to use datetime types and test this with the following code: *RAGG(v_oa_cases.number AS x, * as.POSIXct(2019-01-01 12:00:00) ) This gives an error: No result value in R script execution. Same as specifying the format in as.POSIXct. What could be the problem? Could somebody help with the suitable options? Thank you

3 replies

  • Level 0
  • January 21, 2020
Hi Kestrel, Did you know that there is a built in PQL function called TO_TIMESTAMP? You can find it in the manual, but to give you a relevant example: I think what you are trying to achieve can be done like this: TO_TIMESTAMP( '2019-01-01 12:00:00','YYYY-MM-DD HH:mm:SS') If you want to use R, you would first need to set up your own R server to connect to, I would recommend to do that only if there are no other options, as it brings a lot of overhead. Does this answer your question? Regards, Simon

  • Author
  • Level 1
  • January 21, 2020
Unfortunately there are no other options except of using R due to the complexity of the necessary calculations. In fact firstly I have to generate the regular time sequence with R-code: seq(as.POSIXct(2019-01-09 00:10:00, tz=UTC), as.POSIXct(2019-01-31 00:10:00, tz = UTC), 10 min) RAGG(v_oa_cases.number AS x, s<- seq(1:7)seq(as.POSIXct(2019-01-09 00:10:00, tz=UTC), as.POSIXct(2019-01-31 00:10:00, tz = UTC), 10 min)max(s) ') And the problem is in datetypes, because the following code works without errors: RAGG(v_oa_cases.number AS x, s<-seq(1:7) max(s) ') And if Im working with Celonis Cloud, I also need to set up your own R server to connect to?

  • Level 0
  • January 21, 2020
Hi Kestrel, Unfortunately RAGG and RCALL are not supported in Celonis Cloud. It would be possible to use R code in the Machine Learning Workbench (although it is easier to use Python to integrate with Celonis). I am not that familiar with R, but if the challenge is to create a sequence of timestamps with 10 minutes between them this is also possible in PQL by combining the TO_TIMESTAMP, RANGE and ADD_MINUTES functions. Best regards, Simon Riezebos