[R] data in form of a date

antonio rodriguez antonio.raju at gmail.com
Thu Nov 23 08:21:10 CET 2006


James J. Roper escribió:
> Dear all,
>
> I often use dates and times in analyses.  I just can't figure out how to 
> format my date or time column in R.  So, apparently R sees the date as 
> something other than date (character).  Let's say I am opening a CSV 
> file, one of the columns of which is a date or time.  How do I specify 
> that when opening the file?
>
> Thanks for the help,
>
> Jim
>
>   
Jim,

Suppose a matrix F (6575,189) where rows are days and columns some grid 
points:

First we set the starting date of the series (6575 is the total number 
of days):

library(zoo)
x.Date<-as.Date("1987-12-31")+ c(1:6575)
F.zoo <- zoo(F, x.Date)

#then take a look

F.zoo[,1]

HTH

Antonio



More information about the R-help mailing list