[R-SIG-Finance] Time given the week number and year.

Kevin Burton rkevinburton at charter.net
Tue Oct 11 05:00:18 CEST 2011


The problem with this is that the week number is not specified. What if I
wanted the date for the second week of 2011? Third? Tenth? I cannot
hard-code "-01" for an arbitrary week. 

Thank you.

-----Original Message-----
From: Kalisbek K Malikov [mailto:kkmalikov at suffolk.edu] 
Sent: Monday, October 10, 2011 9:56 PM
To: Kevin Burton; r-sig-finance at stat.math.ethz.ch
Subject: RE: [R-SIG-Finance] Time given the week number and year.

You can try this:
as.Date(paste("2011-01","-01", sep=""))
[1] "2011-01-01"
Hope this helps.
Kalis.
-----Original Message-----
From: r-sig-finance-bounces at r-project.org
[mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Kevin Burton
Sent: Monday, October 10, 2011 10:29 PM
To: r-sig-finance at stat.math.ethz.ch
Subject: [R-SIG-Finance] Time given the week number and year.

I am trying to convert from a week number and year to a date. The first
thing I try

strptime("2011-01", "%Y-%W")

gives me:

[1] "2011-10-10"

This is wrong as the first week of the year is not in October. Any
suggestions on how I can do this conversion?

Thank you.

Kevin

_______________________________________________
R-SIG-Finance at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions
should go.



More information about the R-SIG-Finance mailing list