Re: [R] Convert week value to date

2011-08-22 Thread Folkes, Michael
Here is my solution to produce a date value if your data set only has week values associated with data (ie no date). It gives the first monday of the week. Michael Folkes s - seq(as.Date(2010-01-01), as.Date(2010-12-31), by = day) #produce all days of the year

Re: [R] Convert week value to date

2011-08-19 Thread Heikki Kaskelma
Folkes, Michael: I now realize I could write code to evaluate which of the first 7 days in the year is a Monday and then I'd know the start of week 1 in each year, and multiply from there. But note that library(surveillance) # ISO week isoWeekYear(as.Date(2010-01-01))$ISOWeek [1] 53 so

Re: [R] Convert week value to date

2011-08-18 Thread Folkes, Michael
and then I'd know the start of week 1 in each year, and multiply from there. Thanks Michael -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: August 17, 2011 2:38 PM To: Folkes, Michael Cc: r-help@r-project.org Subject: Re: [R] Convert week value to date On Aug 17

Re: [R] Convert week value to date

2011-08-18 Thread Gabor Grothendieck
On Wed, Aug 17, 2011 at 4:52 PM, Folkes, Michael michael.fol...@dfo-mpo.gc.ca wrote: Hello all, I'm hoping to convert a decimal value for week of the year back to a date object. Eg: strptime(paste(2010,1:52,sep= ),format=%Y %W) I expected (hoped?) this would give me the date for Monday of

[R] Convert week value to date

2011-08-17 Thread Folkes, Michael
Hello all, I'm hoping to convert a decimal value for week of the year back to a date object. Eg: strptime(paste(2010,1:52,sep= ),format=%Y %W) I expected (hoped?) this would give me the date for Monday of each week. Instead, it's giving me 52 values of today's date. Where am I erring? Thanks

Re: [R] Convert week value to date

2011-08-17 Thread David Winsemius
On Aug 17, 2011, at 4:52 PM, Folkes, Michael wrote: Hello all, I'm hoping to convert a decimal value for week of the year back to a date object. Eg: strptime(paste(2010,1:52,sep= ),format=%Y %W) Yeah, agree that seems as though it should have been successful. I cannot get any of my

Re: [R] Convert week value to date

2011-08-17 Thread Duncan Mackay
Hi Michael I am not sure of your decimal format of the week but if you can convert it to a calendar day of the year by multiplying by 7 then you could you could use eg if 321 was the calendar day strptime(paste(2010, 321,sep= ),format=%Y %j) [1] 2010-11-17 Regards Duncan Duncan Mackay