[R] "2013-06-28" coverts to 15884?

William Dunlap wdunlap at tibco.com
Thu Mar 20 00:00:11 CET 2014


Instead of making your initial value of MaxUpdated_row  NULL,
make it a 0-long Date object.  Then c() will work as you wish
(but not rbind).  E.g.,

> MaxUpdated_row <- as.Date(character(0))
> MaxUpdated_row <- c(MaxUpdated_row, as.Date("2013-06-28", "%Y-%m-%d"))
> MaxUpdated_row <- c(MaxUpdated_row, as.Date("2013-07-06", "%Y-%m-%d"))
> str(MaxUpdated_row)
 Date[1:2], format: "2013-06-28" "2013-07-06"

Bill Dunlap
TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of Jason Rupert
> Sent: Wednesday, March 19, 2014 2:47 PM
> To: R-help at r-project.org
> Subject: [R] "2013-06-28" coverts to 15884?
> 
> MaxUpdated_row<-NULL
> MaxUpdated_val<- "2013-06-28"
> 
> 
> rbind(MaxUpdated_row, as.Date(MaxUpdated_val, "%Y-%m-%d"))
>       [,1]
> [1,] 15884
> 
> c(MaxUpdated_row, as.Date(MaxUpdated_val, "%Y-%m-%d""))
> >[1] 15884
> c(MaxUpdated_row, MaxUpdated_val)
> >[1] 15884
> 
> Evidently, I'm again missing something simple, as I would prefer to be able to see the
> actual date to be shown.
> 
> I found a work around, but I don't like it, as I have to convert back to date later:
> c(MaxUpdated_row, as.character(MaxUpdated_val))
> 
> Any alternatives suggestions are much appreciated.
> 	[[alternative HTML version deleted]]




More information about the R-help mailing list