[R] Matrix to dates

Gabor Grothendieck ggrothendieck at myway.com
Tue Dec 9 17:41:34 CET 2003



z <- matrix( c(1960,1960,1961,1,9,6), 3, 2 )

1. Using chron:

 require(chron)
 chron( paste( z[,2], 1, z[,1], sep="/" ) )

2. Using POSIXct:

 ISOdate( z[,1], z[,2], 1 )          # relative to GMT time zone

or

 ISOdate( z[,1], z[,2], 1, tz="" )   # relative to current time zone



---
Date: Mon, 8 Dec 2003 15:48:20 -0600 
From: Erin Hodgess <hodgess at gator.uhd.edu>
To: <r-help at stat.math.ethz.ch> 
Subject: [R] Matrix to dates 

 
 
Let's try again!

I have a matrix in which the first column is a four digit year, and the 
second column is a 2 digit month.

How do I convert the matrix to a date function, please?

Thanks,
Erin
Version 1.8.0
mailto: hodgess at gator.uhd.edu




More information about the R-help mailing list