[R] Convert week value to date
Duncan Mackay
mackay at northnet.com.au
Thu Aug 18 04:05:42 CEST 2011
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
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: home mackay at northnet.com.au
At 06:52 18/08/2011, you 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 each
>week. Instead, it's giving me 52 values of today's date.
>
>Where am I erring?
>Thanks
>Michael
>
>_______________________________________________________
>Michael Folkes
>Salmon Stock Assessment
>Canadian Dept. of Fisheries & Oceans
>Pacific Biological Station
>3190 Hammond Bay Rd.
>Nanaimo, B.C., Canada
>V9T-6N7
>Ph (250) 756-7264 Fax (250) 756-7053 Michael.Folkes at dfo-mpo.gc.ca
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list