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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf
> Of Jason Rupert
> Sent: Wednesday, March 19, 2014 2:47 PM
> To: R-help@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]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to