Re: [R] Write date class as number of days from 1970

2013-05-03 Thread Uwe Ligges
On 03.05.2013 15:59, Manta wrote: Dear all, I have a dataset with one column being of class Date. When I write the output, I would like that column being written as number of days from 1970-01-01. I could not find anywhere a way to do it. as.numeric(x) where x is the Date object. Uwe Ligg

[R] Write date class as number of days from 1970

2013-05-03 Thread Manta
Dear all, I have a dataset with one column being of class Date. When I write the output, I would like that column being written as number of days from 1970-01-01. I could not find anywhere a way to do it. Thanks, Marco -- View this message in context: http://r.789695.n4.nabble.com/Write-date-

Re: [R] Write date class as number of days from 1970

2013-05-03 Thread arun
Hi, May be this helps: set.seed(24) dat1<- data.frame(date1=sample(seq(as.Date("2012-09-14",format="%Y-%m-%d"),length.out=40,by="day"),20,replace=FALSE), value=sample(1:60,20,replace=TRUE)) dat1$days1<- as.numeric(difftime(dat1$date1,as.Date("1970-01-01"))) #or library(lubridate) dat1$days2<- da