The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Execute R: Date Missing in Output
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
RM process file and data source example enclosed.
Thanks,
Pedro
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
RM process file and data source example enclosed.
Thanks,
Pedro
Tagged:
0
Best Answer
-
hughesfleming68 Member Posts: 323 UnicornThis 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,
Alex7
Answers
regards,
Alex
@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
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