I've brought a table into Hue which has a column of dates and i'm trying to play with it using sparklyr in Rstudio.
I'd like to convert a character column into a date column like so:
Weather_data = mutate(Weather_data, date2 = as.Date(date, "%m/%d/%Y"))
and this runs fine but when i check:
head(Weather_data)
How to I properly convert the chr to dates?
Thanks!!!!
The problem is that
sparklyr
doesn't correctly support SparkDateType
. It is possible to parse dates, and correct format, but not represent these as properDateType
columns. If that's enough then please follow the instructions below.In Spark 2.2 or later use
to_date
with JavaSimpleDataFormat
compatible string:Interestingly internal Spark object still uses
DateType
columns:For earlier versions
unix_timestamp
andcast
(but watch for possible timezone problems):Edit:
It looks like this problem has been resolved on current master (
sparklyr_0.7.0-9105
):