Hi!
I am a noob in R, so this is probably my fault, but I am getting slightly different results from running my code in RStudio and in KNIME.
In my code I take the min and max date of a data set for the current loop iteration. I do the following steps:
use as.Date() to convert my “week_ending” column in my data frame to a date.
get the min(week_ending) and max(week_ending) points for the current loop iteration
convert the min & max to date using as.Date (I’m not sure why I have to do this, but if I don’t, the data ends up like in the last screenshot)
save my results as a data frame…
In R Studio, the results are as expected:
When I view the dataframe output in KNIME’s R to Table by double clicking on the name in the workspace, the results are as expected:
However, when I actually view the table in KNIME, the results are not as expected:
Can anyone help me figure out why this is happening?
If it is helpful, I am using packages: “changepoint” and “dplyr” (changepoint also bundles the package “zoo”, which I believe is where as.Date comes from)
Dates and going back and forth between Knime-tables and R isn’t going very smooth. When you start with a date in a Knime table and use the Table to R node it becomes within R a string. As you found out, by using the as.Date() function you can get it into a date again.
Going the other way around with a R to Table node requires that you change the Date-column into a string again.
So something like this:
The result is again something looking like a date in the outputresults.
If you need it to become a real date again you would have to add a String to Date&Time node to change these strings into real dates.