🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Execute R: Date Missing in Output

User: "Oprick"
New Altair Community Member
Updated by Jocelyn
Hi,
In my process  I have have two operators. the first is read.excel and the other is Execute R. In the latter a script fills NAs in time series (daily). All good with that and when I test the script in Rstudio everything seems  to be in place. Though all dates in the output of the operator are missing "?".

Well... in past similar situations that I came across already, after reading some posts here, I was able to proceed by transforming date to character and then in R I would use nominal to date. Which is the solution given in this old thread:  https://community.rapidminer.com/discussion/41481/why-date-data-is-missing-after-output-from-execute-r.

If the script works in Rstudio  I guess that the issue is just "coming back"  to Rapidminer, but what I don't get is why transforming date to character in R is not a solution.

Your help is much appreciated because this is nerve-racking :smile:

RM process file and data source example enclosed.

Thanks,
Pedro

Find more posts tagged with

Sort by:
1 - 5 of 51
    User: "SGolbert"
    New Altair Community Member
    Hi Pedro,

    let me see if I understood correctly. The problem is that in the output of the Execute R operator, the dates columns are missing?

    If you are already transforming to character in R, my guess is that the input dates are not being passed correctly to R. My suggestion is to read the excel files directly in R, RapidMiner can pass the file name if necessary.

    Another option is to do the time series processing in RapidMiner, which can be a time saver in the long run.

    Regards,
    Sebastian

    User: "hughesfleming68"
    New Altair Community Member
    Updated by hughesfleming68
    Try putting in a date to nominal operator with the date format yyyy-MM-dd and see if that works. If that still fails then you need to look at how to work with Posix dates in R to being them back into Rapidminer. POSIXct is where you would need to start.

    regards,

    Alex
    User: "Oprick"
    New Altair Community Member
    OP
    Hi,
    @SGolbert exactly.

    What is really confusing me is that in Rstudio, after running the script I get a data frame (pic enclosed). I guess that the problem doesn't have to do with importing to R.



    I have already tried put date format as yyyy-mm-dd in Rapidminer,but in the end when output of  Execute R is always a date column filled with "?".

    @hughesfleming68:Already try to transform  before in nominal.

    Still getting the "?" dates

    Regards,
    Pedro
    User: "hughesfleming68"
    New Altair Community Member
    Accepted Answer
    Updated by hughesfleming68
    This is a Posix date problem.   dateoutput<-as.POSIXct(date, tz = "")

    In your code:-

    ds2<-ds2%>%
      fill(grw,block)

    ds2$day<-as.POSIXct(ds2$day)

    return(as.data.frame(ds2))

    or just import the process I uploaded.

    regards,

    Alex

    User: "Oprick"
    New Altair Community Member
    OP
    @hughesfleming68 thanks a  lot. That works. 
    In the meanwhile I was able to find a workaround: I just transformed, in R, date column to character and add a random piece of string with "//" as separator. Then, "back" in RM, I used "split" and "nominal  to date". This allowed me to proceed work.

    But of course... Your solution is way more elegant and I'll stick to it.

    Again thanks a lot.

    Regards,
    Pedro