sirme...@gmail.com [sirme...@gmail.com] wrote:

Hi list,

I am having trouble getting R to read and display dates correctly. My dates
are in the form of day (no space) month (no space) year, for example: 250706
and sometimes 50906.

Any guidance would be appreciated...Thanks.

(1) This question has nothing to do with Mac computers.  It should have been 
sent to r-help.

(2) The problem seems to me to be the inconsistency in the number of digits 
representing
"day",  To remedy this, paste on a zero and then remove redundant zeroes:

foo <- function(x) {
              x <- paste(0,x,sep="")
              x <- substr(x,nchar(x)-5,nchar(x))
              strptime(x,format="%d%m%y")
}

x <- c(250706,50906)
foo(x)
[1] "2006-07-25" "2006-09-05"

HTH.

     cheers,

           Rolf Turner
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Reply via email to