Re: [R] transforming dates into years

2010-08-13 Thread Henrique Dallazuanna
You've tried: as.numeric(format(Sys.Date(), '%Y')) On Fri, Aug 13, 2010 at 4:36 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! If I have in my data frame MyFrame a variable saved as a Date and want to translate it into years, I currently do it like this using zoo:

Re: [R] transforming dates into years

2010-08-13 Thread David Winsemius
On Aug 13, 2010, at 3:36 PM, Dimitri Liakhovitski wrote: Hello! If I have in my data frame MyFrame a variable saved as a Date and want to translate it into years, I currently do it like this using zoo: library(zoo) as.year - function(x) as.numeric(floor(as.yearmon(x)))

Re: [R] transforming dates into years

2010-08-13 Thread Saeed Abu Nimeh
myFrame$year-years(strptime(x)) On Fri, Aug 13, 2010 at 12:36 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! If I have in my data frame MyFrame a variable saved as a Date and want to translate it into years, I currently do it like this using zoo: library(zoo) as.year