Why does my date column in data frame change to a double in output from arc.write?

936
3
11-09-2017 02:14 PM
SaraStrachan
New Contributor II

I have a column in a data frame with date (2016-08-25). When I transfer the file to ArcGIS, the output column is converted to a double format and it looks like this (16847). How do I maintain the date format during the transfer?

0 Kudos
3 Replies
ShaunWalbridge
Esri Regular Contributor

Sara,


Could you provide a short example of what you're seeing? The output number you're showing does look like the VT_DATE object that is used internally in some formats for representing a date, but it shouldn't be displayed that way within ArcGIS.

Thanks,

Shaun

0 Kudos
SaraStrachan
New Contributor II

Here's the code I used and I've attached the input. The attached output was exported from the gdb.

----------------------------------------------

library(tidyverse)
library(lubridate)

ID_PM25_2017 <- read.csv("E:/D_drive/R_Projects/Monitors/ID_PM25_dailyAQI_070117to093017.csv",header = TRUE,sep=",", stringsAsFactors = FALSE)

ID_PM25_2017$xDate <- mdy(ID_PM25_2017$xDate)

library(arcgisbinding)
arc.check_product()

arc.write(path = ("E:/D_drive/Pro_Projects/BackgroundConcentrations/BackgroundConcentrations.gdb/ID_PM25_2017"), data = ID_PM25_2017)

-----------------------------------------

0 Kudos
ShaunWalbridge
Esri Regular Contributor

Sara,


Thank you for the reproducible example. It looks like lubridate converts its date objects into the Date class object, and the bridge isn't currently equipped to read these. For now, you can work around this by making this change on line 5 of your script:

ID_PM25_2017$xDate <- as.POSIXct(mdy(ID_PM25_2017$xDate))


I've posted an issue on GitHub to track this, and will update you once we've resolved the underlying issue.


Cheers,
Shaun