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

arun smartpink111 at yahoo.com
Thu Mar 20 15:31:43 CET 2014





Hi,

Not sure if this helps or not:
vec1 <- c(MaxUpdated_row, as.Date(c("2013-06-28","2013-06-29"), "%Y-%m-%d")) + as.Date("1970-01-01")
vec1
#[1] "2013-06-28" "2013-06-29"
str(vec1)
 #Date[1:2], format: "2013-06-28" "2013-06-29"

rbind(MaxUpdated_row, as.Date(c("2013-06-28","2013-06-29"), "%Y-%m-%d")) + as.Date("1970-01-01")
#[1] "2013-06-28" "2013-06-29"

A.K.






On Wednesday, March 19, 2014 5:51 PM, Jason Rupert <jasonkrupert at yahoo.com> wrote:
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 at 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.





More information about the R-help mailing list