[R] Extracting year from a date object

2009-10-06 Thread joris meys
Hi all, this one left me a bit puzzled, as I don't seem to find a function to perform this easily. I must have overlooked the obvious, so sorry in advance. I have a list of dates in numerical format (i.e. 34576), defined as the number of days that passed since january 1st 1900. So I apply the

Re: [R] Extracting year from a date object

2009-10-06 Thread Prof Brian Ripley
See ?weekdays, which says Note: Other components such as the day of the month or the year are very easy to compute: just use 'as.POSIXlt' and extract the relevant component. so as.POSIXlt(MyDate)$year+1900 [1] 1994 is how you are expected to do it. On Tue, 6 Oct 2009, joris