Re: [R] help working with date values

2009-04-28 Thread Steve_Friedman
cc 04/28/2009 09:39 r-help@r-project.org AM ASTSubject Re: [R] help working with date

Re: [R] help working with date values

2009-04-28 Thread Gabor Grothendieck
Here are a few ways: > xx <- c("1985-09-02", "1985-09-16", "1985-07-31", "1985-07-31", "1985-09-02", "1985-08-26", "1985-07-31", "1985-08-26", "1985-09-02", "1985-09-16") > # 1 > library(zoo) > as.numeric(floor(as.yearmon(xx))) [1] 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985 > #2 > as.num

Re: [R] help working with date values

2009-04-28 Thread Uwe Ligges
steve_fried...@nps.gov wrote: My data contains a variable "observation_date" and it contains values as: 1985-09-02 1985-09-15 1985-07-31 1985-09-02 I need to process data annually rather than daily, therefore I'm trying to 1) either extract the first 4 digits from this field and use them as

[R] help working with date values

2009-04-28 Thread Steve_Friedman
My data contains a variable "observation_date" and it contains values as: 1985-09-02 1985-09-15 1985-07-31 1985-09-02 I need to process data annually rather than daily, therefore I'm trying to 1) either extract the first 4 digits from this field and use them as a new variable "year" or 2) kee