R-ArcGIS Bridge Does Not Import Dates Correctly

579
2
07-27-2018 10:59 AM
JonathanGross
New Contributor

I have a point features class in a file geodatabase, and I import into R but the Date Field (formatted as Date field) imports incorrectly (wrong year) and adds time (20:00:00).  Is there anyway to correct this. This error does not occur using rgdal library in R to import the data.

How I imported the data:
library(arcgisbinding)
arc.check_product()
setwd('My Working Directory')
input<-file.path(getwd(),'OpenCrimeData.gdb','PartICrime_Projected')
open_crime<-arc.open(input)
r_open_crime<-arc.select(open_crime)
spatial_open_crime<-arc.data2sp(r_open_crime)

0 Kudos
2 Replies
JonathanGross
New Contributor

Simple fix: df$Date <- as.Date(df$Date,format ='%m/%d/%Y' )

0 Kudos
RamB
by
Occasional Contributor III

This imports as text. Any other solution?

0 Kudos