I'm trying to convert a column from my hadoop data containing UNIX values (integer) to POSIXct format in R. I am using the following code:
hadoop$time <- as.POSIXct(hadoop$time, origin="1970-01-01")
However, when I use as.POSIXct I get the following error:
Error in as.POSIXct.default(hadoop$time, origin="1970-01-01") : do not know how to convert 'hadoop$time' to class "POSIXct"
A sample of my column time values is this:
integer64
[1] 1606851081 1606851075 1606851065 1606850993 1606850976 1606823547
If I put one of these values through the Epoch date converter it returns a valid date time. I have tried multiple solutions posted on here such as using the "as_datetime" function or the "anytime" package. Sample code:
hadoop$time <- anytime(hadoop$time)
hadoop$time <- as_datetime(hadoop$time)
However these attempts have also been unsuccessful. Not sure what I am doing wrong here, hope somebody can help me out.
Some added context: I am running this in a notebook in Databricks.