myFrame$year<-years(strptime(x))
On Fri, Aug 13, 2010 at 12: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.nu
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)))
myFrame$year<-as.yea
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 "
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)))
myFrame$year<-as.year(myFrame$date)
Is there a function that would do it directl
4 matches
Mail list logo