Dates not being read in correctly from R code

aazariaz Registered Posts: 4 ✭✭✭


I'm currently facing an issue where we are using R code to calculate the difference between two date values in days. The code is working fine when we run it in R Studio, but when we put the recipe into Dataiku it seems to not read in the date values correctly. I've attached a screenshot of an example of our expected output vs the type of output we're seeing in Dataiku, and you can see that the date field is being read in as a double instead of a date for some reason.

In the input data, the date is being read in as a string, but in the R code we formatted it as a date and still got the expected output. However, we've now modified the R code to exclude weekends from the calculation, and for some reason this caused the issue to appear. Is there anything we should be changing in the R code or in Dataiku to correct this?

Thank you!


  • TianniL
    TianniL Dataiker Alumni, Registered Posts: 3 ✭✭✭✭
    edited July 17

    Hi Aazariaz,

    I think your actual date format is epoch, instead of date. Maybe you can convert it to date in R

    as.POSIXct(date_in_epoch_format, origin="1970-01-01"))

    or via a prepare recipe. Hope this helps!

Setup Info
      Help me…